diff options
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r-- | tools/syslogd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 04379dfb..44e60b1c 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -849,6 +849,11 @@ die(int sig) errno = 0; logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, 0); } + /* we sleep for 50ms to give the queue a chance to pick up the exit message; + * otherwise we have seen cases where the message did not make it to log + * files, even on idle systems. + */ + srSleep(0, 50); /* drain queue (if configured so) and stop main queue worker thread pool */ DBGPRINTF("Terminating main queue...\n"); @@ -1663,7 +1668,7 @@ doGlblProcessInit(void) if( !(Debug == DEBUG_FULL || NoFork) ) { - DBGPRINTF("Checking pidfile.\n"); + DBGPRINTF("Checking pidfile '%s'.\n", PidFile); if (!check_pid(PidFile)) { memset(&sigAct, 0, sizeof (sigAct)); @@ -1671,6 +1676,9 @@ doGlblProcessInit(void) sigAct.sa_handler = doexit; sigaction(SIGTERM, &sigAct, NULL); + /* stop writing debug messages to stdout (if debugging is on) */ + stddbg = -1; + if (fork()) { /* Parent process */ @@ -1733,7 +1741,7 @@ doGlblProcessInit(void) } /* tuck my process id away */ - DBGPRINTF("Writing pidfile %s.\n", PidFile); + DBGPRINTF("Writing pidfile '%s'.\n", PidFile); if (!check_pid(PidFile)) { if (!write_pid(PidFile)) @@ -1781,7 +1789,6 @@ doGlblProcessInit(void) int realMain(int argc, char **argv) { rsRetVal localRet; - register uchar *p; int ch; extern int optind; extern char *optarg; |