summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-18 11:14:14 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-18 11:14:14 +0200
commitf529e8b2c3bb2c087bfba3fc5610a66fdbe1a8ae (patch)
tree01d936d7497a0c8ab4ba8e73b521042e2bee510f /tools/syslogd.c
parentd2d54013aebb756169182ed8716b142d27134a70 (diff)
parenta6ed4b59cc39fe802d06f113f238f1ffe90b7cf6 (diff)
downloadrsyslog-f529e8b2c3bb2c087bfba3fc5610a66fdbe1a8ae.tar.gz
rsyslog-f529e8b2c3bb2c087bfba3fc5610a66fdbe1a8ae.tar.xz
rsyslog-f529e8b2c3bb2c087bfba3fc5610a66fdbe1a8ae.zip
Merge branch 'master' into newmsg
Conflicts: tools/omfile.c
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index cfecfd83..034111f5 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -887,7 +887,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
MsgSetRcvFrom(pMsg, glbl.GetLocalHostName());
MsgSetRcvFromIP(pMsg, UCHAR_CONSTANT("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:");
@@ -910,7 +910,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 */
@@ -2394,7 +2395,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);
@@ -3055,7 +3056,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();
}