summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/stream.c9
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 */