summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.in1
-rw-r--r--tools/omfile.c24
-rw-r--r--tools/ompipe.c2
-rw-r--r--tools/syslogd.c2
4 files changed, 17 insertions, 12 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 29a5bda..b4532e4 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -277,7 +277,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
moddirs = @moddirs@
diff --git a/tools/omfile.c b/tools/omfile.c
index 150848e..c49a6cd 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -388,6 +388,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
@@ -473,6 +474,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;
}
@@ -549,7 +555,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;
@@ -577,16 +583,17 @@ 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.
*/
if(iMsgOpts & INTERNAL_MSG) {
- DBGPRINTF("Could not open dynaFile, discarding message\n");
+ DBGPRINTF("Could not open dynaFile '%s', state %d, discarding message\n",
+ newFileName, localRet);
} else {
- errmsg.LogError(0, NO_ERRCODE, "Could not open dynamic file '%s' - discarding message", newFileName);
+ errmsg.LogError(0, localRet, "Could not open dynamic file '%s' [state %d] - discarding message", newFileName, localRet);
}
ABORT_FINALIZE(localRet);
}
@@ -657,8 +664,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;
}
@@ -691,7 +696,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:
@@ -824,7 +830,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 58725fb..469d793 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -207,7 +207,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 096f930..6bed6a1 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2129,7 +2129,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");