diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-09 18:07:31 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-09 18:07:31 +0100 |
commit | 3d80d6ba301e4d26b646c84d621ebe880ebc513f (patch) | |
tree | 66564978a733aeb412e825d64783a21acd3ef4fc /tools/omfile.c | |
parent | 7916735ba6890f67d49077975b0d635dc9931380 (diff) | |
download | rsyslog-3d80d6ba301e4d26b646c84d621ebe880ebc513f.tar.gz rsyslog-3d80d6ba301e4d26b646c84d621ebe880ebc513f.tar.xz rsyslog-3d80d6ba301e4d26b646c84d621ebe880ebc513f.zip |
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.
Diffstat (limited to 'tools/omfile.c')
-rw-r--r-- | tools/omfile.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); |