about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;
     }