about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-09-29 17:52:33 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-09-29 17:52:33 -0700
commit32473f59a38631c4bb2403d835b9e007c8a0ddc7 (patch)
tree72df8959fcde37e5968a6c6301f8a98a9f860e5f /Src/hist.c
parent60e31a45b0c015d42e9dc8ca2c991930c3f7fd66 (diff)
parent8cb67e721b3f02779bf4cf0d6a368f67c49c11f8 (diff)
downloadzsh-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.c7
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