summaryrefslogtreecommitdiffstats
path: root/runtime/conf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-05-28 17:59:11 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-05-28 17:59:11 +0200
commit23dac82b684e966490de707a44144b3ad0ce2323 (patch)
tree1972593591da71c31badc1419866c882546048de /runtime/conf.c
parentd8ba1a0d9f1f90c250cc2405f87be151ac609968 (diff)
downloadrsyslog-23dac82b684e966490de707a44144b3ad0ce2323.tar.gz
rsyslog-23dac82b684e966490de707a44144b3ad0ce2323.tar.xz
rsyslog-23dac82b684e966490de707a44144b3ad0ce2323.zip
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]
Diffstat (limited to 'runtime/conf.c')
-rw-r--r--runtime/conf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/conf.c b/runtime/conf.c
index f71d5669..da6026c5 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -395,6 +395,7 @@ processConfFile(uchar *pConfFile)
uchar cbuf[CFGLNSIZ];
uchar *cline;
int i;
+ int bHadAnError = 0;
ASSERT(pConfFile != NULL);
if((cf = fopen((char*)pConfFile, "r")) == NULL) {
@@ -456,6 +457,7 @@ processConfFile(uchar *pConfFile)
snprintf((char*)szErrLoc, sizeof(szErrLoc) / sizeof(uchar),
"%s, line %d", pConfFile, iLnNbr);
errmsg.LogError(0, NO_ERRCODE, "the last error occured in %s", (char*)szErrLoc);
+ bHadAnError = 1;
}
}
@@ -475,6 +477,10 @@ finalize_it:
dbgprintf("error %d processing config file '%s'; os error (if any): %s\n",
iRet, pConfFile, errStr);
}
+
+ if(bHadAnError && (iRet == RS_RET_OK)) { /* a bit dirty, enhance in future releases */
+ iRet = RS_RET_ERR;
+ }
RETiRet;
}