diff mbox

[LEDE-DEV,3/3] procd: Log initscript output prefixed with script name

Message ID 20170311004816.13148-3-sojkam1@fel.cvut.cz
State Accepted
Delegated to: John Crispin
Headers show

Commit Message

Michal Sojka March 11, 2017, 12:48 a.m. UTC
It helps with debugging of initscript problems.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 rcS.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/rcS.c b/rcS.c
index 4813146..0dc0aa2 100644
--- 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);