From 327467c6f685d25621bb33bc3ab746800ba008d2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 27 Feb 2008 09:39:46 +0000 Subject: bugfix: imfile could abort under extreme stress conditions (when it was terminated before it could open all of its to be monitored files) --- plugins/imfile/imfile.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins') 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 -- cgit