aboutsummaryrefslogtreecommitdiff
path: root/coreutils/tee.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-16 07:34:00 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-16 07:34:00 +0000
commit8ddb6410edb0c4e87b4c6b9d0887868977c8eff5 (patch)
tree42a5308572b82bc8eb446dc63d6c63abeddd27e4 /coreutils/tee.c
parentbd9874db7485e827a2b9af6d7066c02692cef46d (diff)
downloadbusybox-w32-8ddb6410edb0c4e87b4c6b9d0887868977c8eff5.tar.gz
busybox-w32-8ddb6410edb0c4e87b4c6b9d0887868977c8eff5.tar.bz2
busybox-w32-8ddb6410edb0c4e87b4c6b9d0887868977c8eff5.zip
tee: fix infinite looping on open error (echo asd | tee "")
Diffstat (limited to 'coreutils/tee.c')
-rw-r--r--coreutils/tee.c4
1 files changed, 3 insertions, 1 deletions
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)
55 *fp = fopen_or_warn(*argv, mode); 55 *fp = fopen_or_warn(*argv, mode);
56 if (*fp == NULL) { 56 if (*fp == NULL) {
57 retval = EXIT_FAILURE; 57 retval = EXIT_FAILURE;
58 argv++;
58 continue; 59 continue;
59 } 60 }
60 } 61 }
61 *np = *argv++; 62 *np = *argv++;
62 GOT_NEW_FILE: 63 GOT_NEW_FILE:
63 setbuf(*fp++, NULL); /* tee must not buffer output. */ 64 setbuf(*fp, NULL); /* tee must not buffer output. */
65 fp++;
64 np++; 66 np++;
65 } while (*argv); 67 } while (*argv);
66 /* names[0] will be filled later */ 68 /* names[0] will be filled later */