From e15d789c84b752bef0519740c36f5f417c2c09c3 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 7 Dec 2019 20:51:00 +0100 Subject: [PATCH] Fix #9: Open kernel log pipe after daemonizing Signed-off-by: Joachim Nilsson --- src/syslogd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/syslogd.c b/src/syslogd.c index b7870db..9991e45 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -372,12 +372,6 @@ int main(int argc, char *argv[]) .pe_mode = 0666, }); - /* Attempt to open kernel log pipe */ - if (opensys(_PATH_KLOG)) - warn("Kernel logging disabled, failed opening %s", _PATH_KLOG); - else - kern_console_off(); - if (!Foreground && !Debug) { ppid = waitdaemon(30); if (ppid < 0) @@ -387,6 +381,12 @@ int main(int argc, char *argv[]) setlinebuf(stdout); } + /* Attempt to open kernel log pipe */ + if (opensys(_PATH_KLOG)) + warn("Kernel logging disabled, failed opening %s", _PATH_KLOG); + else + kern_console_off(); + consfile.f_type = F_CONSOLE; strlcpy(consfile.f_un.f_fname, ctty, sizeof(consfile.f_un.f_fname));