1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-06-02 13:26:03 +02:00

Only call close(flock_fd) if flock_fd is >= 0.

This commit is contained in:
Wayne Davison 2008-05-05 14:29:03 +00:00
parent f7b2570e15
commit c9006a06a3

View File

@ -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
}
}