From d7faed130cb089343ea3d9875561582e6f1d469f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 16 Mar 2010 19:06:01 +0100 Subject: bugfix(cosmetic): tried to close non-open fd, resulting in close(-1) --- runtime/stream.c | 9 +++++++-- 1 file 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 */ -- cgit