Use logit() for _d() and _e() messages as well

The new logit() function takes care to print to stderr if syslogd has
not yet started.  The _d(), _e(), and _pe() macros have an additional
requirement: to always print on stderr.

After the boot we also want to see what happned during, so this patch
simply adds syslog() support to _d(), _e(), and _pe().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-08-18 01:48:41 +02:00
1 parent d670e7d3e8
commit c2ec25efd3
2 files changed
+19 -8

No files matched your search

+5 -4
View File
@@ -39,6 +39,8 @@
#include "private.h"
#include "utmp-api.h"
int _slup = 0; /* INTERNAL: Is syslog up yet? */
char *strip_line(char *line)
{
char *ptr;
@@ -183,18 +185,17 @@ int print_result(int fail)
void logit(int prio, const char *fmt, ...)
{
va_list ap;
static int active = 0;
va_start(ap, fmt);
if (!active && !fexist("/dev/log")) {
if (!_slup && !fexist("/dev/log")) {
vfprintf(stderr, fmt, ap);
va_end(ap);
return;
}
if (!active) {
if (!_slup) {
openlog("finit", LOG_PID, LOG_DAEMON);
active = 1;
_slup = 1;
}
vsyslog(prio, fmt, ap);