summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2008-05-05 14:29:03 +0000
committerWayne Davison <wayned@users.sourceforge.net>2008-05-05 14:29:03 +0000
commitc9006a06a321bc25ffe3ed03f57050258d502c41 (patch)
tree1ccf3826edbee58786c759ac4c4ae16ac2e3330b
parentf7b2570e158e8fbf84c8a96bced4f9866feeb753 (diff)
downloadzsh-c9006a06a321bc25ffe3ed03f57050258d502c41.tar.gz
zsh-c9006a06a321bc25ffe3ed03f57050258d502c41.zip
Only call close(flock_fd) if flock_fd is >= 0.
-rw-r--r--Src/hist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c
index e5de9572e..a1bc73636 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2330,8 +2330,10 @@ savehistfile(char *fn, int err, int writeflags)
} else {
/* We renamed over the locked HISTFILE, so close fd.
* If we do more writing, we'll get a lock then. */
- close(flock_fd);
- flock_fd = -1;
+ if (flock_fd >= 0) {
+ close(flock_fd);
+ flock_fd = -1;
+ }
#endif
}
}