summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--runtime/stream.c1
-rw-r--r--tools/omfile.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 321963dd..5f495768 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
---------------------------------------------------------------------------
Version 4.6.2 [v4-stable] (rgerhards), 2010-03-??
+- bugfix: potential problem (loop, abort) when file write error occured
+ When a write error occured in stream.c, variable iWritten had the error
+ code but this was handled as if it were the actual number of bytes
+ written. That was used in pointer arithmetic later on, and thus could
+ lead to all sorts of problems. However, this could only happen if the
+ error was EINTR or the file in question was a tty. All other cases were
+ handled properly. Now, iWritten is reset to zero in such cases, resulting
+ in proper retries.
- bugfix: $omfileFlushOnTXEnd was turned on when set to off and vice
versa due to an invalid check
- added new property replacer option "date-rfc3164-buggyday" primarily
diff --git a/runtime/stream.c b/runtime/stream.c
index 36f44003..82718099 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -790,6 +790,7 @@ doWriteCall(strm_t *pThis, uchar *pBuf, size_t *pLenBuf)
if(iWritten < 0) {
char errStr[1024];
int err = errno;
+ iWritten = 0; /* we have written NO bytes! */
rs_strerror_r(err, errStr, sizeof(errStr));
DBGPRINTF("log file (%d) write error %d: %s\n", pThis->fd, err, errStr);
if(err == EINTR) {
diff --git a/tools/omfile.c b/tools/omfile.c
index 8fbf8fea..daefa680 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -79,7 +79,7 @@ DEFobjCurrIf(strm)
struct s_dynaFileCacheEntry {
uchar *pName; /* name currently open, if dynamic name */
strm_t *pStrm; /* our output stream */
- time_t lastUsed; /* for LRU - last access */ // TODO: perforamcne change to counter (see other comment!)
+ time_t lastUsed; /* for LRU - last access */
};
typedef struct s_dynaFileCacheEntry dynaFileCacheEntry;
@@ -532,7 +532,7 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts)
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
}
pCache[iFirstFree]->pStrm = pData->pStrm;
- pCache[iFirstFree]->lastUsed = time(NULL); // monotonically increasing value! TODO: performance
+ pCache[iFirstFree]->lastUsed = time(NULL);
pData->iCurrElt = iFirstFree;
DBGPRINTF("Added new entry %d for file cache, file '%s'.\n", iFirstFree, newFileName);