Git-Url:
http://git.frugalware.org/gitweb/gitweb.cgi?p=setup/.git;a=commitdiff;h=bd5797e762c33a28308cbc14c1a81b15610def23
commit bd5797e762c33a28308cbc14c1a81b15610def23
Author: VMiklos <[EMAIL PROTECTED]>
Date: Sun Jul 15 13:35:23 2007 +0200
LOG(): record messages to /var/log/setup.log, not only to tty4
diff --git a/src/setup.h b/src/setup.h
index 7a1c769..d41d18c 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -29,6 +29,7 @@
#define _(text) gettext(text)
#define LOGDEV "/dev/tty4"
+#define LOGFILE "/var/log/setup.log"
#define SOURCEDIR "/mnt/source"
#define TARGETDIR "/mnt/target"
diff --git a/src/util.c b/src/util.c
index e22222f..93492b1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -663,7 +663,7 @@ void show_menu(GList *plugin_list, int *state)
int setup_log(char *file, int line, char *fmt, ...)
{
- FILE *fp;
+ static FILE *ldp = NULL, *lfp = NULL;
va_list args;
char str[PATH_MAX];
@@ -671,11 +671,22 @@ int setup_log(char *file, int line, char *fmt, ...)
vsnprintf(str, PATH_MAX, fmt, args);
va_end(args);
- fp = fopen(LOGDEV, "w");
- if(!fp)
- return(-1);
- fprintf(fp, "%s:%d: %s\n", file, line, str);
- fclose(fp);
+ if(!ldp)
+ {
+ ldp = fopen(LOGDEV, "w");
+ if(!ldp)
+ return(-1);
+ }
+ if(!lfp)
+ {
+ lfp = fopen(LOGFILE, "w");
+ if(!lfp)
+ return(-1);
+ }
+ fprintf(ldp, "%s:%d: %s\n", file, line, str);
+ fflush(ldp);
+ fprintf(lfp, "%s:%d: %s\n", file, line, str);
+ fflush(lfp);
return(0);
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git