summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-09-26 12:48:57 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-09-26 12:48:57 +0200
commitf2528ec101eb660560c7ec327d440cbb17f04f14 (patch)
tree05083efcd96dedc9387579caa17c81b8b78592c6 /tools
parentceb336f0398e37ab51b4b54a14fa394d53ccdf3f (diff)
parent0c7604dc27119122a3022c7bf094ffb5f8d59e6d (diff)
downloadrsyslog-f2528ec101eb660560c7ec327d440cbb17f04f14.tar.gz
rsyslog-f2528ec101eb660560c7ec327d440cbb17f04f14.tar.xz
rsyslog-f2528ec101eb660560c7ec327d440cbb17f04f14.zip
Merge branch 'v5-devel'
Conflicts: ChangeLog configure.ac doc/manual.html runtime/conf.c tools/omfile.c tools/omusrmsg.c
Diffstat (limited to 'tools')
-rw-r--r--tools/omfile.c22
-rw-r--r--tools/omusrmsg.c6
-rw-r--r--tools/syslogd.c2
3 files changed, 17 insertions, 13 deletions
diff --git a/tools/omfile.c b/tools/omfile.c
index 3cc3a7f9..e68bddd4 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -427,6 +427,7 @@ prepareFile(instanceData *pData, uchar *newFileName)
int fd;
DEFiRet;
+ pData->pStrm = NULL;
if(access((char*)newFileName, F_OK) != 0) {
/* file does not exist, create it (and eventually parent directories */
if(pData->bCreateDirs) {
@@ -497,8 +498,10 @@ prepareFile(instanceData *pData, uchar *newFileName)
CHKiRet(strm.ConstructFinalize(pData->pStrm));
finalize_it:
- if(pData->pStrm == NULL) {
- DBGPRINTF("Error opening log file: %s\n", pData->f_fname);
+ if(iRet != RS_RET_OK) {
+ if(pData->pStrm != NULL) {
+ strm.Destruct(&pData->pStrm);
+ }
}
RETiRet;
}
@@ -576,7 +579,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;
@@ -604,8 +607,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.
@@ -613,7 +616,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);
}
@@ -683,10 +686,6 @@ writeFile(uchar **ppString, unsigned iMsgOpts, instanceData *pData)
CHKiRet(doWrite(pData, ppString[0], strlen(CHAR_CONVERT(ppString[0]))));
finalize_it:
- if(iRet != RS_RET_OK) {
-
- iRet = RS_RET_SUSPENDED;
- }
RETiRet;
}
@@ -719,7 +718,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:
diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c
index 358b6ce7..f30af5c3 100644
--- a/tools/omusrmsg.c
+++ b/tools/omusrmsg.c
@@ -388,6 +388,7 @@ ENDnewActInst
BEGINparseSelectorAct
es_str_t *usrs;
+ int bHadWarning;
CODESTARTparseSelectorAct
CODE_STD_STRING_REQUESTparseSelectorAct(1)
if(!strncmp((char*) p, ":omusrmsg:", sizeof(":omusrmsg:") - 1)) {
@@ -395,12 +396,13 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
} else {
if(!*p || !((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z')
|| (*p >= '0' && *p <= '9') || *p == '_' || *p == '.' || *p == '*')) {
- ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED);
+ ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED);
} else {
errmsg.LogError(0, RS_RET_OUTDATED_STMT,
"action '%s' treated as ':omusrmsg:%s' - please "
"change syntax, '%s' will not be supported in the future",
p, p, p);
+ bHadWarning = 1;
}
}
@@ -424,6 +426,8 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
!= RS_RET_OK)
goto finalize_it;
}
+ if(iRet == RS_RET_OK && bHadWarning)
+ iRet = RS_RET_OK_WARN;
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 6d794260..d1224f2d 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1368,7 +1368,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");