summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-18 11:11:07 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-18 11:11:07 +0200
commit17133f2cd18a2b5376d40a01b87c970b3a47c265 (patch)
treeef857337dc0db50271c7e30faae259d6fba3f0cd /tools/syslogd.c
parent3e2be47ed69d2b4ce21777a75ad6128592e84d1d (diff)
parentbca66bc1399d1b9bcc370c64b5a8befb2244695d (diff)
downloadrsyslog-17133f2cd18a2b5376d40a01b87c970b3a47c265.tar.gz
rsyslog-17133f2cd18a2b5376d40a01b87c970b3a47c265.tar.xz
rsyslog-17133f2cd18a2b5376d40a01b87c970b3a47c265.zip
Merge branch 'v3-stable' into beta
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 2ff868a9..77273bec 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -933,7 +933,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
MsgSetRcvFrom(pMsg, (char*)glbl.GetLocalHostName());
MsgSetRcvFromIP(pMsg, (uchar*)"127.0.0.1");
/* check if we have an error code associated and, if so,
- * adjust the tag. -- r5gerhards, 2008-06-27
+ * adjust the tag. -- rgerhards, 2008-06-27
*/
if(iErr == NO_ERRCODE) {
MsgSetTAG(pMsg, "rsyslogd:");
@@ -956,7 +956,8 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
* supressor statement.
*/
if(((Debug || NoFork) && bErrMsgToStderr) || iConfigVerify) {
- fprintf(stderr, "rsyslogd: %s\n", msg);
+ if(LOG_PRI(pri) == LOG_ERR)
+ fprintf(stderr, "rsyslogd: %s\n", msg);
}
if(bHaveMainQueue == 0) { /* not yet in queued mode */
@@ -1922,10 +1923,10 @@ 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 */
- if(Debug || NoFork)
+ if(Debug)
write(1, MSG1, sizeof(MSG1) - 1);
if(iRetries++ == 4) {
- if(Debug || NoFork)
+ if(Debug)
write(1, MSG2, sizeof(MSG2) - 1);
abort();
}
@@ -2531,7 +2532,7 @@ init(void)
*/
snprintf(bufStartUpMsg, sizeof(bufStartUpMsg)/sizeof(char),
" [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \
- "\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"] restart",
+ "\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"] (re)start",
(int) myPid);
logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)bufStartUpMsg, 0);
@@ -3249,7 +3250,9 @@ doGlblProcessInit(void)
exit(1); /* "good" exit - after forking, not diasabling anything */
}
num_fds = getdtablesize();
- for (i= 0; i < num_fds; i++)
+ close(0);
+ /* we keep stdout and stderr open in case we have to emit something */
+ for (i = 3; i < num_fds; i++)
(void) close(i);
untty();
}