summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index b6e1d826..a39f5a5c 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1871,16 +1871,22 @@ void legacyOptsParseTCP(char ch, char *arg)
* a minimal delay, but it is much cleaner than the approach of doing everything
* inside the signal handler.
* rgerhards, 2005-10-26
+ * Note: we do not call dbgprintf() as this may cause us to block in case something
+ * with the threading is wrong.
*/
static void doDie(int sig)
{
+# define MSG1 "DoDie called.\n"
+# define MSG2 "DoDie called 5 times - unconditional exit\n"
static int iRetries = 0; /* debug aid */
- printf("DoDie called.\n");
+ write(1, MSG1, sizeof(MSG1));
if(iRetries++ == 4) {
- printf("DoDie called 5 times - unconditional exit\n");
+ write(1, MSG2, sizeof(MSG2));
abort();
}
bFinished = sig;
+# undef MSG1
+# undef MSG2
}
@@ -2832,9 +2838,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 +3087,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);