diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-15 08:12:14 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-15 08:12:14 +0200 |
commit | ff6232d2bee06fbbc25ad83a1cf3bb798884679a (patch) | |
tree | ec92e5bd324abe3999754b6aebf0d9d0d3f78be0 | |
parent | 2cf3b2fa3c5c5b6cbf104294c7fc8860bb49bac0 (diff) | |
download | rsyslog-ff6232d2bee06fbbc25ad83a1cf3bb798884679a.tar.gz rsyslog-ff6232d2bee06fbbc25ad83a1cf3bb798884679a.tar.xz rsyslog-ff6232d2bee06fbbc25ad83a1cf3bb798884679a.zip |
bugfix: error messages were not emitted to stderr in forked mode
stderr and stdo are now kept open across fork()
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | tools/syslogd.c | 7 |
2 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 3.22.1 [v3-stable] (rgerhards), 2009-04-?? +- bugfix: error messages were not emitted to stderr in forked mode + (stderr and stdo are now kept open across forks) - bugfix: internal messages were emitted to whatever file had fd2 when rsyslogd ran in forked mode (as usual!) Thanks to varmojfekoj for the patch diff --git a/tools/syslogd.c b/tools/syslogd.c index 357f6699..0f63f1bc 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -925,7 +925,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags) * permits us to process unmodified config files which otherwise contain a * supressor statement. */ - if(((Debug || NoFork) && bErrMsgToStderr) || iConfigVerify) { + if(bErrMsgToStderr || iConfigVerify) { fprintf(stderr, "rsyslogd: %s\n", msg); } @@ -3096,7 +3096,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(); } @@ -3532,6 +3534,7 @@ finalize_it: */ int main(int argc, char **argv) { + fprintf(stderr, "rsyslogd startup\n"); dbgClassInit(); return realMain(argc, argv); } |