bore

basic core utilities (PD)
git clone git://bvnf.space/bore.git
Log | Files | Refs | README

commit 736a64ef010ca844b6afc0c71ccef9e4e3b18df9
parent 556d0844e9342ad62ed3dc9e3f9479d8db9d11e8
Author: phoebos <ben@bvnf.space>
Date:   Sat, 26 Feb 2022 19:21:36 +0000

tee: don't try to write to files that weren't opened

Diffstat:
Mtee.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

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