From 802cdd4f5e822ffdb2f895943a27b4ca88c9a9f2 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Sat, 18 Oct 2008 14:13:15 +0000 Subject: 25910: avoid dangling file handle in bin_print. --- Src/builtin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Src') 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; -- cgit 1.4.1