summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-04-05 11:40:53 +0000
committerJim Meyering <jim@meyering.net>2005-04-05 11:40:53 +0000
commitdce4a77a9931d921fbc0f0578ebc8041cce5709e (patch)
treeb320093024445b8c618c7464d48b523cc3108249
parent78eefa7b187161dd233817f921e1c32701a2a898 (diff)
downloadcoreutils-dce4a77a9931d921fbc0f0578ebc8041cce5709e.tar.xz
(tee): When closing files, do not close stdout,
leave this job to close_stdout() instead. From Dmitry V. Levin.
-rw-r--r--src/tee.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tee.c b/src/tee.c
index 3639366b2..209dbc03e 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -204,7 +204,8 @@ tee (int nfiles, const char **files)
/* Close the files, but not standard output. */
for (i = 1; i <= nfiles; i++)
- if (descriptors[i] && fclose (descriptors[i]) != 0)
+ if (!STREQ (files[i], "-")
+ && descriptors[i] && fclose (descriptors[i]) != 0)
{
error (0, errno, "%s", files[i]);
ok = false;