diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-16 19:06:01 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-16 19:06:01 +0100 |
commit | d7faed130cb089343ea3d9875561582e6f1d469f (patch) | |
tree | 1459a3690545de32154bc998e051830df9fbf8f2 /runtime/stream.c | |
parent | a577b09e58789c39b2f50e0bd89125fbad76672a (diff) | |
download | rsyslog-d7faed130cb089343ea3d9875561582e6f1d469f.tar.gz rsyslog-d7faed130cb089343ea3d9875561582e6f1d469f.tar.xz rsyslog-d7faed130cb089343ea3d9875561582e6f1d469f.zip |
bugfix(cosmetic): tried to close non-open fd, resulting in close(-1)
Diffstat (limited to 'runtime/stream.c')
-rw-r--r-- | runtime/stream.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/stream.c b/runtime/stream.c index 3373b795..87daedaf 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -325,8 +325,13 @@ static rsRetVal strmCloseFile(strm_t *pThis) } } - close(pThis->fd); - pThis->fd = -1; + /* the file may already be closed (or never have opened), so guard + * against this. -- rgerhards, 2010-03-19 + */ + if(pThis->fd != -1) { + close(pThis->fd); + pThis->fd = -1; + } if(pThis->fdDir != -1) { /* close associated directory handle, if it is open */ |