bore

Unnamed repository
Log | Files | Refs | README

commit 171f08f68eef6d96162f4ae52bc140669532612e
parent c73ad798c221616e30db4ab5b962a669bfdbfaae
Author: phoebos <ben@bvnf.space>
Date:   Wed, 22 Sep 2021 17:59:58 +0100

wc: fclose

Diffstat:
Mwc.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/wc.c b/wc.c @@ -93,6 +93,12 @@ main(int argc, char **argv) { ret_val = 1; continue; } + + if (fileno(f) != 0 && fclose(f) == EOF) { + fprintf(stderr, "wc: %s: %s\n", *argv, strerror(errno)); + ret_val = 1; + } + print_count(&ct, *argv, flags); global.l += ct.l; global.w += ct.w;