From: Denis Vlasenko Date: Tue, 15 Jul 2008 05:10:15 +0000 (-0000) Subject: tee: "-" is a name for stdout, handle it that way X-Git-Tag: 1_12_0~184 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4b8171cd7ac73f9dfaf3873ee5a964e6801be9e4;p=oweals%2Fbusybox.git tee: "-" is a name for stdout, handle it that way --- diff --git a/coreutils/tee.c b/coreutils/tee.c index b38801755..8a4128591 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -50,10 +50,13 @@ int tee_main(int argc, char **argv) files[0] = stdout; goto GOT_NEW_FILE; do { - *fp = fopen_or_warn(*argv, mode); - if (*fp == NULL) { - retval = EXIT_FAILURE; - continue; + *fp = stdout; + if (NOT_LONE_DASH(*argv)) { + *fp = fopen_or_warn(*argv, mode); + if (*fp == NULL) { + retval = EXIT_FAILURE; + continue; + } } *np = *argv++; GOT_NEW_FILE: