When procd starts a rcS script, it captures its stdout and stderr and
logs them via syslog(). The problem with that is that the rest of
procd code uses ulog rather than syslog() directly and ulog_open()
doesn't call openlog() immediately, but only after something is logged
with ulog(). This lazy calling of openlog() can result in the
following unwanted behavior:
1) When rcS's stdout/err is logged via syslog(), the log identifier is
not set yet (due to openlog() not called) and so the log message
lacks information about source.
2) procd can also log stdout/err from services. When a message from a
service needs to be logged, ulog_open() is called to change the log
identifier to match the service name/PID. After logging the service
messages, ulog_open() is called again the change the identifier
back to "procd". The lazy call to openlog() means that the messages
logged directly with syslog() will be logged with the
identification of the previously logged service and not of the rcS
script that produced the message.
Both problems are fixed by replacing direct call to syslog() with
ULOG_NOTE, which automatically calls openlog() if needed.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
break;
*newline = 0;
len = newline + 1 - str;
- syslog(LOG_NOTICE, "%s", str);
+ ULOG_NOTE("%s", str);
#ifdef SHOW_BOOT_ON_CONSOLE
fprintf(stderr, "%s\n", str);
#endif