about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2008-11-12 12:57:25 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2008-11-12 12:57:25 +0000
commit61e9152b112b22ee145d4775d7df7ed9a6ed8329 (patch)
tree27e6e3fd64f7b84cca9c72e2e406ee1a347195e4
parent18f9bf0a36e9865778873b007b7c73849c5d75b3 (diff)
downloadzsh-61e9152b112b22ee145d4775d7df7ed9a6ed8329.tar.gz
zsh-61e9152b112b22ee145d4775d7df7ed9a6ed8329.tar.xz
zsh-61e9152b112b22ee145d4775d7df7ed9a6ed8329.zip
26028: close temporary file when aborting fc
-rw-r--r--ChangeLog4
-rw-r--r--Src/builtin.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 33c599948..353c2992f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-12  Oliver Kiddle  <opk@zsh.org>
+
+	* 26028: Src/builtin.c: close temporary file when aborting fc
+
 2008-11-12  Peter Stephenson  <pws@csr.com>
 
 	* 26029: Test/A04redirect.ztst: add test for redirection operators
diff --git a/Src/builtin.c b/Src/builtin.c
index 0748eaccc..72c519037 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1480,6 +1480,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
 		    unqueue_signals();
 		    zwarnnam("fc",
 		      "current history line would recurse endlessly, aborted");
+		    fclose(out);
 		    unlink(fil);
 		    return 1;
 		}
@@ -1619,6 +1620,8 @@ fclist(FILE *f, Options ops, zlong first, zlong last,
 	    zwarnnam("fc", "no such event: %s", buf);
 	} else
 	    zwarnnam("fc", "no events in that range");
+	if (f != stdout)
+	    fclose(f);
 	return 1;
     }