diff options
author | Mattias Andrée <maandree@kth.se> | 2019-06-21 21:23:28 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-06-21 21:23:28 +0200 |
commit | 9530053c551fa0e9bad2a0ffda905bb5a9e5e234 (patch) | |
tree | 972f82f82c0b14a3a3ca3cb84766c58ca74045e2 /loc.c | |
parent | Fix tabulation (diff) | |
download | loc-9530053c551fa0e9bad2a0ffda905bb5a9e5e234.tar.gz loc-9530053c551fa0e9bad2a0ffda905bb5a9e5e234.tar.bz2 loc-9530053c551fa0e9bad2a0ffda905bb5a9e5e234.tar.xz |
Fix error handling in the case of 1 file argument4
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | loc.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -163,7 +163,10 @@ main(int argc, char *argv[]) n = count(fd, argv[0]); close(fd); } - printf("%zi\n", n); + if (n >= 0) + printf("%zi\n", n); + else + ret = 1; } else { if (!(res = calloc(argc, sizeof(struct result)))) fprintf(stderr, "%s: out of memory\n", argv0), exit(1); |