Fix #8: kernel messages duplicated to console
When building the sysklogd project --without-klogd we must disable the kernel logging to console on Linux. This fix depends on how the sysctl setting `kernel.printk` is configured. The patch only calls the kernel to set console_loglevel to minimum_console_loglevel. See the kernel docs for details: https://www.kernel.org/doc/Documentation/sysctl/kernel.txt Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -385,6 +385,8 @@ int main(int argc, char *argv[])
|
||||
/* Attempt to open kernel log pipe */
|
||||
if (opensys(_PATH_KLOG))
|
||||
warn("Kernel logging disabled, failed opening %s", _PATH_KLOG);
|
||||
else
|
||||
kern_console_off();
|
||||
#endif
|
||||
|
||||
if (!Foreground) {
|
||||
@@ -2016,6 +2018,10 @@ void die(int signo)
|
||||
free(pe);
|
||||
}
|
||||
|
||||
#ifndef KLOGD
|
||||
kern_console_on();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user