Save and restore the state of the variable Initialized inside die().

Otherwise, the shutdown message will print out with 15 NUL bytes in
front, due to a missing timestamp.
This commit is contained in:
Joerg Wunsch 1997-03-14 01:27:02 +00:00
parent 9163ee5e9d
commit d086327d14
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=23868

View File

@ -39,7 +39,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
*/ */
static const char rcsid[] = static const char rcsid[] =
"$Id$"; "$Id: syslogd.c,v 1.20 1997/02/22 16:14:00 peter Exp $";
#endif /* not lint */ #endif /* not lint */
/* /*
@ -1016,8 +1016,10 @@ die(signo)
int signo; int signo;
{ {
struct filed *f; struct filed *f;
int was_initialized;
char buf[100]; char buf[100];
was_initialized = Initialized;
Initialized = 0; /* Don't log SIGCHLDs. */ Initialized = 0; /* Don't log SIGCHLDs. */
for (f = Files; f != NULL; f = f->f_next) { for (f = Files; f != NULL; f = f->f_next) {
/* flush any pending output */ /* flush any pending output */
@ -1026,6 +1028,7 @@ die(signo)
if (f->f_type == F_PIPE) if (f->f_type == F_PIPE)
(void)close(f->f_file); (void)close(f->f_file);
} }
Initialized = was_initialized;
if (signo) { if (signo) {
dprintf("syslogd: exiting on signal %d\n", signo); dprintf("syslogd: exiting on signal %d\n", signo);
(void)sprintf(buf, "exiting on signal %d", signo); (void)sprintf(buf, "exiting on signal %d", signo);