summaryrefslogtreecommitdiffstats
path: root/plugins/imfile/imfile.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-10-15 08:23:29 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-10-15 08:23:29 +0200
commited9fd3541f07929008a64f5b6ea3bcce70e62c25 (patch)
treee82a339428b39355a3e13a29f139987c07bd19c3 /plugins/imfile/imfile.c
parent8c3d40b798e3ed68fb03629d87b55140cb6bc044 (diff)
downloadrsyslog-ed9fd3541f07929008a64f5b6ea3bcce70e62c25.tar.gz
rsyslog-ed9fd3541f07929008a64f5b6ea3bcce70e62c25.tar.xz
rsyslog-ed9fd3541f07929008a64f5b6ea3bcce70e62c25.zip
imfile: bug fixes
either one or two bugs fixed ;) Definitely a problem where no state file is written when working with relative pathes. Also, some problems with offsets should be fixed for very large files. However, I could not yet experimentally show the issue so it probably needs more verification.
Diffstat (limited to 'plugins/imfile/imfile.c')
-rw-r--r--plugins/imfile/imfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 8a10e26f..e067014e 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -337,12 +337,15 @@ persistStrmState(fileInfo_t *pInfo)
{
DEFiRet;
strm_t *psSF = NULL; /* state file (stream) */
+ size_t lenDir;
ASSERT(pInfo != NULL);
/* TODO: create a function persistObj in obj.c? */
CHKiRet(strm.Construct(&psSF));
- CHKiRet(strm.SetDir(psSF, glbl.GetWorkDir(), strlen((char*)glbl.GetWorkDir())));
+ lenDir = ustrlen(glbl.GetWorkDir());
+ if(lenDir > 0)
+ CHKiRet(strm.SetDir(psSF, glbl.GetWorkDir(), lenDir));
CHKiRet(strm.SettOperationsMode(psSF, STREAMMODE_WRITE_TRUNC));
CHKiRet(strm.SetsType(psSF, STREAMTYPE_FILE_SINGLE));
CHKiRet(strm.SetFName(psSF, pInfo->pszStateFile, strlen((char*) pInfo->pszStateFile)));