diff options
author | Clint Adams <clint@users.sourceforge.net> | 2008-10-18 14:13:15 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2008-10-18 14:13:15 +0000 |
commit | 802cdd4f5e822ffdb2f895943a27b4ca88c9a9f2 (patch) | |
tree | cf46b04daed67834b159c5e320334650ff08c263 /Src | |
parent | 52fba13e9baab656b8901ebf308197169eab8947 (diff) | |
download | zsh-802cdd4f5e822ffdb2f895943a27b4ca88c9a9f2.tar.gz zsh-802cdd4f5e822ffdb2f895943a27b4ca88c9a9f2.tar.xz zsh-802cdd4f5e822ffdb2f895943a27b4ca88c9a9f2.zip |
25910: avoid dangling file handle in bin_print.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index e852092e2..003897bb4 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3689,8 +3689,11 @@ bin_print(char *name, char **args, Options ops, int func) if (OPT_ISSET(ops,'o') || OPT_ISSET(ops,'O')) { int flags; - if (fmt && !*args) + if (fmt && !*args) { + if (fout != stdout) + fclose(fout); return 0; + } flags = OPT_ISSET(ops,'i') ? SORTIT_IGNORING_CASE : 0; if (OPT_ISSET(ops,'O')) flags |= SORTIT_BACKWARDS; |