diff options
author | Eric Leblond <eric@regit.org> | 2014-02-04 00:33:47 +0100 |
---|---|---|
committer | Eric Leblond <eric@regit.org> | 2014-02-04 00:33:47 +0100 |
commit | 7a6c850e9f439b73e31f81dac6cb02b9bafbc866 (patch) | |
tree | 3ba5df6baa2e49fe43c57c759cfd2a5b8db29970 /src/ulogd.c | |
parent | e0ae1870e5b15138c12071d9d96522a2720bf44a (diff) |
ulogd: avoid potential double print of message
In case there is no logfile, ulogd could possibly display each
log message twice to stderr.
Diffstat (limited to 'src/ulogd.c')
-rw-r--r-- | src/ulogd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ulogd.c b/src/ulogd.c index 2c0fbd1..810f828 100644 --- a/src/ulogd.c +++ b/src/ulogd.c @@ -442,7 +442,7 @@ void __ulogd_log(int level, char *file, int line, const char *format, ...) timestr = ctime(&tm); timestr[strlen(timestr)-1] = '\0'; fprintf(outfd, "%s <%1.1d> %s:%d ", timestr, level, file, line); - if (verbose) + if (verbose && outfd != stderr) fprintf(stderr, "%s <%1.1d> %s:%d ", timestr, level, file, line); @@ -452,7 +452,7 @@ void __ulogd_log(int level, char *file, int line, const char *format, ...) /* flush glibc's buffer */ fflush(outfd); - if (verbose) { + if (verbose && outfd != stderr) { va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); |