tee: fix infinite looping on open error (echo asd | tee "")
This commit is contained in:
parent
bd9874db74
commit
8ddb6410ed
@ -55,12 +55,14 @@ int tee_main(int argc, char **argv)
|
|||||||
*fp = fopen_or_warn(*argv, mode);
|
*fp = fopen_or_warn(*argv, mode);
|
||||||
if (*fp == NULL) {
|
if (*fp == NULL) {
|
||||||
retval = EXIT_FAILURE;
|
retval = EXIT_FAILURE;
|
||||||
|
argv++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*np = *argv++;
|
*np = *argv++;
|
||||||
GOT_NEW_FILE:
|
GOT_NEW_FILE:
|
||||||
setbuf(*fp++, NULL); /* tee must not buffer output. */
|
setbuf(*fp, NULL); /* tee must not buffer output. */
|
||||||
|
fp++;
|
||||||
np++;
|
np++;
|
||||||
} while (*argv);
|
} while (*argv);
|
||||||
/* names[0] will be filled later */
|
/* names[0] will be filled later */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user