2000-12-17 09:55:50

by Clayton Weaver

[permalink] [raw]
Subject: klogd -f logname "append to logname" patch

(For anyone else who shares the opinion that

klogd -f /var/log/kmsg -x

should append to its kmsg log file instead of overwriting it.)

-f insulates klogd messages from syslogd bugs (although you can't split
them up into multiple files the way that /etc/syslog.conf enables). You
can always solve any klogd-to-syslogd problem *after* you find out what
is otherwise wrong with your kernel (and lose the -f switch then if that's
what you prefer or require). But when you are debugging a kernel deadlock
with no oops, for example, and actually have local persistent storage
to write to, it helps if the next hard reset doesn't truncate the -f
pathname when klogd opens it.

--- klogd.c.orig Mon Sep 18 00:34:11 2000
+++ klogd.c Wed Nov 29 14:06:40 2000
@@ -1109,7 +1109,7 @@
{
if ( strcmp(output, "-") == 0 )
output_file = stdout;
- else if ( (output_file = fopen(output, "w")) == (FILE *) 0 )
+ else if ( (output_file = fopen(output, "a")) == (FILE *) 0 )
{
fprintf(stderr, "klogd: Cannot open output file " \
"%s - %s\n", output, strerror(errno));

Regards,

Clayton Weaver
<mailto:[email protected]>
(Seattle)

"Everybody's ignorant, just in different subjects." Will Rogers