bore

Unnamed repository
Log | Files | Refs

commit 6ca04fd206737e0d63acd81521297f9d4878fcc0
parent 0f1826ad5aea5a7e10c94d37f3ae960d615c6adc
Author: aabacchus <ben@bvnf.space>
Date:   Sun, 19 Sep 2021 21:27:36 +0100

tee: fix behaviour when no filenames given

previously in this case, i = 0 so while(--i) is infinite. also, the for loop
in tee() means that in this case, we only write to stdout once.

Diffstat:
Mtee.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tee.c b/tee.c @@ -63,7 +63,7 @@ main(int argc, char **argv) { if (tee(fds, i) != 0) { err = 1; } - while (--i) { + while (--i > 0) { if (close(fds[i]) == -1){ fprintf(stderr, "tee: close: %s\n", strerror(errno)); err = 1;