diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2008-05-05 14:29:03 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2008-05-05 14:29:03 +0000 |
commit | c9006a06a321bc25ffe3ed03f57050258d502c41 (patch) | |
tree | 1ccf3826edbee58786c759ac4c4ae16ac2e3330b | |
parent | f7b2570e158e8fbf84c8a96bced4f9866feeb753 (diff) | |
download | zsh-c9006a06a321bc25ffe3ed03f57050258d502c41.tar.gz zsh-c9006a06a321bc25ffe3ed03f57050258d502c41.tar.xz zsh-c9006a06a321bc25ffe3ed03f57050258d502c41.zip |
Only call close(flock_fd) if flock_fd is >= 0.
-rw-r--r-- | Src/hist.c | 6 |
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 } } |