diff -ur sysklogd-1.3-31.orig/klogd.c sysklogd-1.3-31/klogd.c --- sysklogd-1.3-31.orig/klogd.c Tue Jan 19 11:09:12 1999 +++ sysklogd-1.3-31/klogd.c Sun Feb 21 23:24:03 1999 @@ -213,6 +213,11 @@ * Shortened LOG_LINE_LENGTH in order to get long lines splitted * up earlier and syslogd has a better chance concatenating them * together again. + * + * Sun Feb 21 22:19:47 EST 1999: Keith Owens + * When symbols are expanded, print the line twice. Once with addresses + * converted to symbols, once with the raw text. Allows external programs + * such as ksymoops do their own processing on the original data. */ @@ -638,6 +643,11 @@ * in length to LOG_LINE_LENGTH, the symbol will not be expanded. * (This should never happen, since the kernel should never generate * messages that long. + * + * To preserve the original addresses, lines containing kernel symbols + * are output twice. Once with the symbols converted and again with the + * original text. Just in case somebody wants to run their own Oops + * analysis on the syslog, e.g. ksymoops. */ static void LogLine(char *ptr, int len) { @@ -657,6 +667,10 @@ static char *sym_start; /* points at the '<' of a symbol */ auto int delta = 0; /* number of chars copied */ + auto int symbols_expanded = 0; /* 1 if symbols were expanded */ + auto int skip_symbol_lookup = 0; /* skip symbol lookup on this pass */ + auto char *save_ptr = ptr; /* save start of input line */ + auto int save_len = len; /* save length at start of input line */ while( len > 0 ) { @@ -677,6 +691,10 @@ line = line_buff; space = sizeof(line_buff)-1; parse_state = PARSING_TEXT; + symbols_expanded = 0; + skip_symbol_lookup = 0; + save_ptr = ptr; + save_len = len; } switch( parse_state ) @@ -703,6 +721,18 @@ Syslog( LOG_INFO, line_buff ); line = line_buff; space = sizeof(line_buff)-1; + if (symbols_expanded) { + /* reprint this line without symbol lookup */ + symbols_expanded = 0; + skip_symbol_lookup = 1; + ptr = save_ptr; + len = save_len; + } + else { + skip_symbol_lookup = 0; + save_ptr = ptr; + save_len = len; + } break; } if( *ptr == '[' ) /* possible kernel symbol */ @@ -710,7 +740,8 @@ *line++ = *ptr++; space -= 1; len -= 1; - parse_state = PARSING_SYMSTART; /* at < */ + if (! skip_symbol_lookup) + parse_state = PARSING_SYMSTART; /* at < */ break; } if( *ptr == '%' ) /* dangerous printf marker */ @@ -828,6 +859,7 @@ space = sym_space + delta; line = sym_start + delta; + symbols_expanded = 1; } ptr++; len--; diff -ur sysklogd-1.3-31.orig/ksym.c sysklogd-1.3-31/ksym.c --- sysklogd-1.3-31.orig/ksym.c Tue Oct 13 02:39:49 1998 +++ sysklogd-1.3-31/ksym.c Sun Feb 21 22:30:17 1999 @@ -99,6 +99,9 @@ * . extract major.minor.patch from utsname.release via sscanf() * The reason lays in possible use of kernel flavours which * modify utsname.release but no the Version_ symbol. + * + * Sun Feb 21 22:27:49 EST 1999: Keith Owens + * Fixed bug that caused klogd to die if there is no sym_array available. */ @@ -636,9 +639,12 @@ { auto int lp; - auto char *last = sym_array[0].name; + auto char *last; + if (!sym_array) + return((char *) 0); + last = sym_array[0].name; sym->offset = 0; sym->size = 0; if ( value < sym_array[0].value )