summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-09-20 15:16:53 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-09-20 15:16:53 +0200
commit086db18cc304c9aff082e8ee4adfdadeacfa5c39 (patch)
tree0eb8e98e22224c6e792f0c75c1dd9eda528feafd
parent1d0e4ba3b34464343c388ccef3ca8b08df42076a (diff)
downloadrsyslog-086db18cc304c9aff082e8ee4adfdadeacfa5c39.tar.gz
rsyslog-086db18cc304c9aff082e8ee4adfdadeacfa5c39.tar.xz
rsyslog-086db18cc304c9aff082e8ee4adfdadeacfa5c39.zip
bugfix: potential abort if ultra-large file io buffers are used and
dynafile cache exhausts address space (primarily a problem on 32 bit platforms)
-rw-r--r--ChangeLog5
-rw-r--r--tools/omfile.c14
2 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a0989c7..78c9217b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------
+Version 4.8.1 [v4-beta], 2011-09-??
+- bugfix: potential abort if ultra-large file io buffers are used and
+ dynafile cache exhausts address space (primarily a problem on 32 bit
+ platforms)
+---------------------------------------------------------------------------
Version 4.8.0 [v4-stable] (rgerhards), 2011-09-07
***************************************************************************
* This is a new stable v4 version. It contains all fixes and enhancements *
diff --git a/tools/omfile.c b/tools/omfile.c
index 88e8115e..f7339300 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -355,6 +355,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
@@ -440,6 +441,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;
}
@@ -516,7 +522,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;
@@ -545,8 +551,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.
@@ -554,7 +560,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);
}