summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-27 09:39:46 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-27 09:39:46 +0000
commit327467c6f685d25621bb33bc3ab746800ba008d2 (patch)
treea3997dcdb00e9f49c0e9badd103eb070ccd12e0f
parent3a20ee45be537a98d9da4a7dc994b375ac4a7055 (diff)
downloadrsyslog-327467c6f685d25621bb33bc3ab746800ba008d2.tar.gz
rsyslog-327467c6f685d25621bb33bc3ab746800ba008d2.tar.xz
rsyslog-327467c6f685d25621bb33bc3ab746800ba008d2.zip
bugfix: imfile could abort under extreme stress conditions (when it was
terminated before it could open all of its to be monitored files)
-rw-r--r--plugins/imfile/imfile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index b3b2f060..ba09ea42 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -332,11 +332,15 @@ BEGINafterRun
int i;
CODESTARTafterRun
/* Close files and persist file state information. We do NOT abort on error iRet as that makes
- * matters worse (at least we can try persisting the others...).
+ * matters worse (at least we can try persisting the others...). Please note that, under stress
+ * conditions, it may happen that we are terminated before we actuall could open all streams. So
+ * before we change anything, we need to make sure the stream was open.
*/
for(i = 0 ; i < iFilPtr ; ++i) {
- persistStrmState(&files[i]);
- strmDestruct(&(files[i].pStrm));
+ if(files[i].pStrm != NULL) { /* stream open? */
+ persistStrmState(&files[i]);
+ strmDestruct(&(files[i].pStrm));
+ }
}
ENDafterRun