From: Denis Vlasenko Date: Wed, 16 Jul 2008 07:34:00 +0000 (-0000) Subject: tee: fix infinite looping on open error (echo asd | tee "") X-Git-Tag: 1_12_0~174 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8ddb6410edb0c4e87b4c6b9d0887868977c8eff5;p=oweals%2Fbusybox.git tee: fix infinite looping on open error (echo asd | tee "") --- diff --git a/coreutils/tee.c b/coreutils/tee.c index 8a4128591..dc947c935 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -55,12 +55,14 @@ int tee_main(int argc, char **argv) *fp = fopen_or_warn(*argv, mode); if (*fp == NULL) { retval = EXIT_FAILURE; + argv++; continue; } } *np = *argv++; GOT_NEW_FILE: - setbuf(*fp++, NULL); /* tee must not buffer output. */ + setbuf(*fp, NULL); /* tee must not buffer output. */ + fp++; np++; } while (*argv); /* names[0] will be filled later */