diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2014-09-29 17:52:33 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2014-09-29 17:52:33 -0700 |
commit | 32473f59a38631c4bb2403d835b9e007c8a0ddc7 (patch) | |
tree | 72df8959fcde37e5968a6c6301f8a98a9f860e5f /Src/hist.c | |
parent | 60e31a45b0c015d42e9dc8ca2c991930c3f7fd66 (diff) | |
parent | 8cb67e721b3f02779bf4cf0d6a368f67c49c11f8 (diff) | |
download | zsh-32473f59a38631c4bb2403d835b9e007c8a0ddc7.tar.gz zsh-32473f59a38631c4bb2403d835b9e007c8a0ddc7.tar.xz zsh-32473f59a38631c4bb2403d835b9e007c8a0ddc7.zip |
Merge branch 'master' of git://git.code.sf.net/p/zsh/code
Conflicts: ChangeLog
Diffstat (limited to 'Src/hist.c')
-rw-r--r-- | Src/hist.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/hist.c b/Src/hist.c index d29a65afe..4660fd073 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -2593,7 +2593,12 @@ savehistfile(char *fn, int err, int writeflags) out = NULL; } else { int fd = open(tmpfile, O_CREAT | O_WRONLY | O_EXCL, 0600); - out = fd >= 0 ? fdopen(fd, "w") : NULL; + if (fd >=0) { + out = fdopen(fd, "w"); + if (!out) + close(fd); + } else + out = NULL; } #ifdef HAVE_FCHMOD |