[PATCH] klogd: Handle facility too when reading from /proc/kmsg

Karol Lewandowski k.lewandowsk at samsung.com
Tue Dec 27 13:46:47 UTC 2011


Support userspace applications like udev and systemd logging directly
to kernel's log buffer.
---
 sysklogd/klogd.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index efa0e53..100031c 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -234,15 +234,13 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
 				*newline++ = '\0';
 			}
 
-			/* Extract the priority */
+			/* Extract the facility and priority */
 			priority = LOG_INFO;
 			if (*start == '<') {
 				start++;
-				if (*start) {
-					/* kernel never generates multi-digit prios */
-					priority = (*start - '0');
-					start++;
-				}
+
+				priority = strtoul(start, &start, 10);
+
 				if (*start == '>')
 					start++;
 			}
-- 
1.7.7.3


-- 
Karol Lewandowski | Samsung Poland R&D Center | Linux/Platform


More information about the busybox mailing list