aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-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)
*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 */