Only log to stderr if opening /dev/kmsg failed for early logging

This patch prevents double critical/error messages from being printed on
the console when there is no syslog daemon running yet.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-09-08 17:11:52 +02:00
parent 4b4572de4d
commit b4f385d2e0
+2 -2
View File
@@ -197,9 +197,9 @@ void logit(int prio, const char *fmt, ...)
fclose(fp);
} else {
fprintf(stderr, "Failed opening /dev/kmsg for appending ...\n");
if (prio <= LOG_ERR)
vfprintf(stderr, fmt, ap);
}
if (prio <= LOG_ERR)
vfprintf(stderr, fmt, ap);
va_end(ap);
return;
}