File PhantomasPC-0.9-logfile.patch of Package PhantomasPC
--- src/log.c
+++ src/log.c
@@ -5,6 +5,7 @@
License: Giftware.
*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -23,13 +24,16 @@
static char disable_log=0;
unsigned long int size=0L;
time_t ti;
+static char* logfile;
if (init)
{
- file=fopen(LOGFILE,"at+");
+ asprintf(&logfile,"%s/.phantpc/%s",getenv("HOME"),LOGFILE);
+ file=fopen(logfile,"at+");
if (file==NULL)
{
disable_log=1;
+ free(logfile);
}
else
{
@@ -39,7 +43,7 @@
if (size>=10000)
{
fclose(file);
- delete_file(LOGFILE);
+ delete_file(logfile);
}
}
}
@@ -47,7 +51,7 @@
if (!disable_log)
{
va_start(args,format);
- file=fopen(LOGFILE,"at+");
+ file=fopen(logfile,"at+");
if (init)
{