Fix #9: Open kernel log pipe after daemonizing

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-12-07 20:51:00 +01:00
parent 3462e2ba19
commit e15d789c84

View File

@ -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));