diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-11-17 13:32:58 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-11-17 13:32:58 +0000 |
commit | c694d8b8695e0a73f20d7d1dcff82abc53d348b0 (patch) | |
tree | 559b4b05c62dc9c0e0a70c3540a5fd3d9f1a3748 | |
parent | 06b76af511bf08d2714f3fb710712a92a50dd865 (diff) |
reread config from main loop instead of signal hander; ok deraadt@
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 1e90b4d2e8f..f16fd55037c 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.44 2001/11/16 19:57:33 deraadt Exp $ */ +/* $OpenBSD: syslogd.c,v 1.45 2001/11/17 13:32:57 markus Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #else -static char rcsid[] = "$OpenBSD: syslogd.c,v 1.44 2001/11/16 19:57:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: syslogd.c,v 1.45 2001/11/17 13:32:57 markus Exp $"; #endif #endif /* not lint */ @@ -196,6 +196,7 @@ int MarkSeq = 0; /* mark sequence number */ sig_atomic_t MarkSet; sig_atomic_t WantDie; +sig_atomic_t DoInit; int SecureMode = 1; /* when true, speak only unix domain socks */ @@ -203,11 +204,12 @@ void cfline __P((char *, struct filed *, char *)); char *cvthname __P((struct sockaddr_in *)); int decode __P((const char *, CODE *)); void dodie __P((int)); +void doinit __P((int)); void die __P((int)); void domark __P((int)); void markit __P((void)); void fprintlog __P((struct filed *, int, char *)); -void init __P((int)); +void init __P((void)); void logerror __P((char *)); void logmsg __P((int, char *, char *, int)); void printline __P((char *, char *)); @@ -231,6 +233,7 @@ main(argc, argv) int ch, i, fklog, len, linesize, fdsrmax = 0; struct sockaddr_un sunx, fromunix; struct sockaddr_in sin, frominet; + sigset_t blockmask; fd_set *fdsr = NULL; char *p, *line; FILE *fp; @@ -292,6 +295,9 @@ main(argc, argv) linesize++; line = malloc(linesize); + sigemptyset(&blockmask); + sigaddset(&blockmask, SIGHUP); + (void)signal(SIGHUP, doinit); (void)signal(SIGTERM, dodie); (void)signal(SIGINT, Debug ? dodie : SIG_IGN); (void)signal(SIGQUIT, Debug ? dodie : SIG_IGN); @@ -357,8 +363,7 @@ main(argc, argv) dprintf("off & running....\n"); - init(0); - (void)signal(SIGHUP, init); + init(); if (fklog != -1 && fklog > fdsrmax) fdsrmax = fklog; @@ -380,6 +385,13 @@ main(argc, argv) if (WantDie) die(WantDie); + sigprocmask(SIG_BLOCK, &blockmask, NULL); + if (DoInit) { + init(); + DoInit = 0; + } + sigprocmask(SIG_UNBLOCK, &blockmask, NULL); + bzero(fdsr, howmany(fdsrmax+1, NFDBITS) * sizeof(fd_mask)); @@ -908,6 +920,13 @@ domark(signo) MarkSet = 1; } +void +doinit(signo) + int signo; +{ + DoInit = 1; +} + /* * Print syslogd errors some place. */ @@ -960,8 +979,7 @@ die(signo) * INIT -- Initialize syslogd from configuration table */ void -init(signo) - int signo; +init() { int i; FILE *cf; |