summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-13 11:44:59 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-13 11:44:59 +0000
commitde1f787307066bea620b3d6631ac68ebf657d561 (patch)
tree3e4d9d68c294f6daa2b9e85cfbfa8529effb8d55 /stream.c
parent18bea60667f4ced5ac65e91fbd7c7a00ba22b319 (diff)
downloadrsyslog-de1f787307066bea620b3d6631ac68ebf657d561.tar.gz
rsyslog-de1f787307066bea620b3d6631ac68ebf657d561.tar.xz
rsyslog-de1f787307066bea620b3d6631ac68ebf657d561.zip
- fixed a race condition in DoDie() - cosmetic issue in debugging mode,
could not happen in production - added the ability to persist current read location for the file monitor
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/stream.c b/stream.c
index 97b679d2..79d34d5d 100644
--- a/stream.c
+++ b/stream.c
@@ -78,8 +78,14 @@ static rsRetVal strmOpenFile(strm_t *pThis)
CHKiRet(genFileName(&pThis->pszCurrFName, pThis->pszDir, pThis->lenDir,
pThis->pszFName, pThis->lenFName, pThis->iCurrFNum, pThis->iFileNumDigits));
} else {
- if((pThis->pszCurrFName = (uchar*) strdup((char*) pThis->pszFName)) == NULL)
- ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
+RUNLOG_VAR("%s", pThis->pszDir);
+ if(pThis->pszDir == NULL) {
+ if((pThis->pszCurrFName = (uchar*) strdup((char*) pThis->pszFName)) == NULL)
+ ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
+ } else {
+ CHKiRet(genFileName(&pThis->pszCurrFName, pThis->pszDir, pThis->lenDir,
+ pThis->pszFName, pThis->lenFName, -1, 0));
+ }
}
/* compute which flags we need to provide to open */
@@ -196,10 +202,8 @@ strmHandleEOFMonitor(strm_t *pThis)
ABORT_FINALIZE(RS_RET_IO_ERROR);
dbgoprint((obj_t*)pThis, "curr ino %d, new ino %d, curr offset %lld, new size %ld\n", statOpen.st_ino, statName.st_ino, pThis->iCurrOffs, statName.st_size);
if(statOpen.st_ino == statName.st_ino && pThis->iCurrOffs == statName.st_size) {
-RUNLOG_STR("EOF");
ABORT_FINALIZE(RS_RET_EOF);
} else {
-RUNLOG_STR("file change");
/* we had a file change! */
CHKiRet(strmCloseFile(pThis));
CHKiRet(strmOpenFile(pThis));