summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-09-18 12:19:33 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-09-18 12:19:33 +0200
commit4c96ebdcfe075e80810b01257cf21ea1c9b3ec0e (patch)
treeb6768398d8d55c04e045b5213e11b952484025e8 /tools
parent988989e49ef8639123c83383ba256c4e67679c8d (diff)
downloadrsyslog-4c96ebdcfe075e80810b01257cf21ea1c9b3ec0e.tar.gz
rsyslog-4c96ebdcfe075e80810b01257cf21ea1c9b3ec0e.tar.xz
rsyslog-4c96ebdcfe075e80810b01257cf21ea1c9b3ec0e.zip
bugfix: potential race condition when adding messages to queue
There was a wrong order of mutex lock operations. It is hard to believe that really caused problems, but in theory it could and with threading we often see that theory becomes practice if something is only used long enough on a fast enough machine with enough CPUs ;)
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index b6e1d826..3a637dd8 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2832,9 +2832,8 @@ static rsRetVal mainThread()
CHKiRet(init());
- if(Debug) {
+ if(Debug && debugging_on) {
dbgprintf("Debugging enabled, SIGUSR1 to turn off debugging.\n");
- debugging_on = 1;
}
/* Send a signal to the parent so it can terminate.
*/
@@ -3082,9 +3081,9 @@ doGlblProcessInit(void)
fputs(" Already running.\n", stderr);
exit(1); /* "good" exit, done if syslogd is already running */
}
- }
- else
+ } else {
debugging_on = 1;
+ }
/* tuck my process id away */
dbgprintf("Writing pidfile %s.\n", PidFile);