summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2024-06-13 11:12:41 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2024-06-13 11:18:13 +0900
commita3b56d4f03e493985aa652248e9476c1f8181e4e (patch)
treeb11c5dca027775626f10cbf9d387944fed276588
parent52946: Revert "Handle completer filenames with funny characters in them" (diff)
downloadzsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.tar
zsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.tar.gz
zsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.tar.bz2
zsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.tar.lz
zsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.tar.xz
zsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.tar.zst
zsh-a3b56d4f03e493985aa652248e9476c1f8181e4e.zip
52951: make sure to close memstream for 'print -v'
-rw-r--r--ChangeLog4
-rw-r--r--Src/builtin.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 29546095d..455cf38c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-06-13 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 52951: Src/builtin.c: make sure to close memstream for 'print -v'
+
2024-06-08 Mikael Magnusson <mikachu@gmail.com>
* 52946: Completion/compdump, Completion/compinit: Revert 52768
diff --git a/Src/builtin.c b/Src/builtin.c
index 7bfb1ce1d..cd0ee7522 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5455,9 +5455,8 @@ bin_print(char *name, char **args, Options ops, int func)
}
zwarnnam(name, "%s: invalid directive", start);
if (*c) c[1] = save;
- /* Why do we care about a clean close here? */
- if (!CLOSE_CLEANLY(fout))
- zwarnnam(name, "write error: %e", errno);
+ if (fout != stdout)
+ fclose(fout);
#ifdef HAVE_OPEN_MEMSTREAM
if (buf)
free(buf);