X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=sysklogd%2Fklogd.c;h=432ded1530be3054bf1f3ee9130d025a803833ee;hb=d60752f8c9be5689a249ad518deb38061d4bc45e;hp=3992081caf98daead392e3a34bcde894854a0b37;hpb=5bc8c005a8e15c43285bc595a8d404de67a482ac;p=oweals%2Fbusybox.git diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index 3992081ca..432ded153 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c @@ -21,8 +21,7 @@ //usage: "[-c N] [-n]" //usage:#define klogd_full_usage "\n\n" //usage: "Kernel logger\n" -//usage: "\nOptions:" -//usage: "\n -c N Only messages with level < N are printed to console" +//usage: "\n -c N Print to console messages more urgent than prio N (1-8)" //usage: "\n -n Run in foreground" #include "libbb.h" @@ -196,6 +195,8 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) syslog(LOG_NOTICE, "klogd started: %s", bb_banner); + write_pidfile(CONFIG_PID_FILE_PATH "/klogd.pid"); + used = 0; while (!bb_got_signal) { int n; @@ -239,11 +240,8 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) priority = LOG_INFO; if (*start == '<') { start++; - if (*start) { - /* kernel never generates multi-digit prios */ - priority = (*start - '0'); - start++; - } + if (*start) + priority = strtoul(start, &start, 10); if (*start == '>') start++; } @@ -259,6 +257,7 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) klogd_close(); syslog(LOG_NOTICE, "klogd: exiting"); + remove_pidfile(CONFIG_PID_FILE_PATH "/klogd.pid"); if (bb_got_signal) kill_myself_with_sig(bb_got_signal); return EXIT_FAILURE;