[LEDE-DEV] [PATCH 2/3] procd: Don't use syslog before its initialization

Michal Sojka sojkam1 at fel.cvut.cz
Fri Mar 10 16:48:15 PST 2017


When procd starts a rcS script, it captures its stdout and stderr and
logs them to syslog. It could happen (and I don't know exactly why),
that a rcS scripts produces some output before openlog() is called in
procd. The result is that all subsequent logs from procd are logged
with ident and PID of some other service that happens to be started at
that time. I also have no clue why this is happening (bug in musl?),
but it is very confusing when one tries to debug boot problems.

Note that the problem does not appear, when booting with init_debug=5.

This problem seems to be fixed by replacing direct call to syslog()
with ULOG_NOTE, which automatically calls openlog() if needed.

Signed-off-by: Michal Sojka <sojkam1 at fel.cvut.cz>
---
 rcS.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rcS.c b/rcS.c
index 0208a75..4813146 100644
--- a/rcS.c
+++ b/rcS.c
@@ -54,7 +54,7 @@ static void pipe_cb(struct ustream *s, int bytes)
 			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
-- 
2.11.0




More information about the Lede-dev mailing list