From d8ba1a0d9f1f90c250cc2405f87be151ac609968 Mon Sep 17 00:00:00 2001 From: varmojfekoj Date: Thu, 28 May 2009 16:01:34 +0200 Subject: bugfix: internal messages were emitted to whatever file had fd2 ...when rsyslogd ran in forked mode (as usual!) Signed-off-by: Rainer Gerhards --- tools/syslogd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/syslogd.c') diff --git a/tools/syslogd.c b/tools/syslogd.c index b0d6fa25..1840030b 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(bErrMsgToStderr || iConfigVerify) { + if(((Debug || NoFork) && bErrMsgToStderr) || iConfigVerify) { fprintf(stderr, "rsyslogd: %s\n", msg); } -- cgit v1.2.3 From 23dac82b684e966490de707a44144b3ad0ce2323 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 28 May 2009 17:59:11 +0200 Subject: small enhancement: config validation run now exits with code 1 if an error is detected. This change is considered important but small enough to apply it directly to the stable version. [But it is a border case, the change requires more code than I had hoped. Thus I have NOT tried to actually catch all cases, this is left for the current devel releases, if necessary] --- tools/syslogd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/syslogd.c') diff --git a/tools/syslogd.c b/tools/syslogd.c index 1840030b..01d3af71 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -2237,6 +2237,7 @@ init(void) DEFiRet; rsRetVal localRet; int iNbrActions; + int bHadConfigErr = 0; char cbuf[BUFSIZ]; char bufStartUpMsg[512]; struct sigaction sigAct; @@ -2287,9 +2288,11 @@ init(void) if(localRet != RS_RET_OK) { errmsg.LogError(0, localRet, "CONFIG ERROR: could not interpret master config file '%s'.", ConfFile); + bHadConfigErr = 1; } else if(iNbrActions == 0) { errmsg.LogError(0, RS_RET_NO_ACTIONS, "CONFIG ERROR: there are no active actions configured. Inputs will " "run, but no output whatsoever is created."); + bHadConfigErr = 1; } if(localRet != RS_RET_OK || iNbrActions == 0) { @@ -2355,8 +2358,13 @@ init(void) /* we are done checking the config - now validate if we should actually run or not. * If not, terminate. -- rgerhards, 2008-07-25 */ - if(iConfigVerify) + if(iConfigVerify) { + if(bHadConfigErr) { + /* a bit dirty, but useful... */ + exit(1); + } ABORT_FINALIZE(RS_RET_VALIDATION_RUN); + } /* switch the message object to threaded operation, if necessary */ if(MainMsgQueType == QUEUETYPE_DIRECT || iMainMsgQueueNumWorkers > 1) { -- cgit v1.2.3