summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-09-26 12:12:48 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-09-26 12:12:48 +0200
commit76b4c6547d5526a375ee217e2722a164c811c58c (patch)
treecbcca91a01d64106e3b26480d08c7e8766735d2b /tools
parent0509f1404170c5aff7c9a154fbe882f4d067b1e4 (diff)
parentb26387e6b28630b8e5e3582039141ebf1c7455e3 (diff)
downloadrsyslog-76b4c6547d5526a375ee217e2722a164c811c58c.tar.gz
rsyslog-76b4c6547d5526a375ee217e2722a164c811c58c.tar.xz
rsyslog-76b4c6547d5526a375ee217e2722a164c811c58c.zip
Merge branch 'v5-stable' into beta
Conflicts: ChangeLog configure.ac doc/manual.html
Diffstat (limited to 'tools')
-rw-r--r--tools/omfile.c21
-rw-r--r--tools/ompipe.c2
-rw-r--r--tools/syslogd.c2
3 files changed, 15 insertions, 10 deletions
diff --git a/tools/omfile.c b/tools/omfile.c
index a861ed0b..d4e8c20b 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -400,6 +400,7 @@ prepareFile(instanceData *pData, uchar *newFileName)
int fd;
DEFiRet;
+ pData->pStrm = NULL;
if(access((char*)newFileName, F_OK) == 0) {
if(pData->bForceChown) {
/* Try to fix wrong ownership set by someone else. Note that this code
@@ -485,6 +486,11 @@ prepareFile(instanceData *pData, uchar *newFileName)
CHKiRet(strm.ConstructFinalize(pData->pStrm));
finalize_it:
+ if(iRet != RS_RET_OK) {
+ if(pData->pStrm != NULL) {
+ strm.Destruct(&pData->pStrm);
+ }
+ }
RETiRet;
}
@@ -561,7 +567,7 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts)
pData->iCurrElt = -1;
/* similarly, we need to set the current pStrm to NULL, because otherwise, if prepareFile() fails,
* we may end up using an old stream. This bug depends on how exactly prepareFile fails,
- * but it* could be triggered in the common case of a failed open() system call.
+ * but it could be triggered in the common case of a failed open() system call.
* rgerhards, 2010-03-22
*/
pData->pStrm = NULL;
@@ -589,8 +595,8 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts)
/* Ok, we finally can open the file */
localRet = prepareFile(pData, newFileName); /* ignore exact error, we check fd below */
- /* file is either open now or an error state set */ // RG: better check localRet?
- if(pData->pStrm == NULL) {
+ /* check if we had an error */
+ if(localRet != RS_RET_OK) {
/* do not report anything if the message is an internally-generated
* message. Otherwise, we could run into a never-ending loop. The bad
* news is that we also lose errors on startup messages, but so it is.
@@ -598,7 +604,7 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts)
if(iMsgOpts & INTERNAL_MSG) {
DBGPRINTF("Could not open dynaFile, discarding message\n");
} else {
- errmsg.LogError(0, NO_ERRCODE, "Could not open dynamic file '%s' - discarding message", newFileName);
+ errmsg.LogError(0, NO_ERRCODE, "Could not open dynamic file '%s' [state %d] - discarding message", newFileName, localRet);
}
ABORT_FINALIZE(localRet);
}
@@ -669,8 +675,6 @@ finalize_it:
/* in v5, we shall return different states for message-caused failure (but only there!) */
if(pData->strmType == STREAMTYPE_NAMED_PIPE)
iRet = RS_RET_DISABLE_ACTION; /* this is the traditional semantic -- rgerhards, 2010-01-15 */
- else
- iRet = RS_RET_SUSPENDED;
}
RETiRet;
}
@@ -703,7 +707,8 @@ ENDbeginTransaction
BEGINendTransaction
CODESTARTendTransaction
- if(pData->bFlushOnTXEnd) {
+ /* Note: pStrm may be NULL if there was an error opening the stream */
+ if(pData->bFlushOnTXEnd && pData->pStrm != NULL) {
CHKiRet(strm.Flush(pData->pStrm));
}
finalize_it:
@@ -836,7 +841,7 @@ CODESTARTparseSelectorAct
if(pData->pStrm == NULL) {
DBGPRINTF("Error opening log file: %s\n", pData->f_fname);
- errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output file '%s'", pData->f_fname);
+ errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could not open output file '%s'", pData->f_fname);
}
}
CODE_STD_FINALIZERparseSelectorAct
diff --git a/tools/ompipe.c b/tools/ompipe.c
index 01695369..4bf166e2 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -217,7 +217,7 @@ CODESTARTparseSelectorAct
if(pData->fd < 0 ) {
pData->fd = -1;
DBGPRINTF("Error opening log pipe: %s\n", pData->f_fname);
- errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output pipe '%s'", pData->f_fname);
+ errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could not open output pipe '%s'", pData->f_fname);
}
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 25ab05cd..78b9933f 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2124,7 +2124,7 @@ static void printVersion(void)
#else
printf("\t32bit Atomic operations supported:\tNo\n");
#endif
-#ifdef HAVE_ATOMIC_BUILTINS64
+#ifdef HAVE_ATOMIC_BUILTINS_64BIT
printf("\t64bit Atomic operations supported:\tYes\n");
#else
printf("\t64bit Atomic operations supported:\tNo\n");