procd: Log initscript output prefixed with script name
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 11 Mar 2017 00:48:16 +0000 (01:48 +0100)
committerJohn Crispin <john@phrozen.org>
Mon, 20 Mar 2017 07:08:03 +0000 (08:08 +0100)
It helps with debugging of initscript problems.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
rcS.c

diff --git a/rcS.c b/rcS.c
index 48131462631b2c3ba7624195f722a032973eea0a..0dc0aa2fea02b400c6cd4798c1926671acc0bd14 100644 (file)
--- a/rcS.c
+++ b/rcS.c
@@ -42,6 +42,7 @@ struct initd {
 
 static void pipe_cb(struct ustream *s, int bytes)
 {
+       struct initd *initd = container_of(s, struct initd, fd.stream);
        char *newline, *str;
        int len;
 
@@ -54,9 +55,9 @@ static void pipe_cb(struct ustream *s, int bytes)
                        break;
                *newline = 0;
                len = newline + 1 - str;
-               ULOG_NOTE("%s", str);
+               ULOG_NOTE("%s: %s", initd->file, str);
 #ifdef SHOW_BOOT_ON_CONSOLE
-               fprintf(stderr, "%s\n", str);
+               fprintf(stderr, "%s: %s\n", initd->file, str);
 #endif
                ustream_consume(s, len);
        } while (1);