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
1 changed files with 4 additions and 2 deletions

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