From 76ea3fdd52d306faffb8b40842c73639fbbfc957 Mon Sep 17 00:00:00 2001 From: sin <sin@2f30.org> Date: Wed, 11 Mar 2015 12:32:44 +0000 Subject: [PATCH] cksum: Report exit status properly --- cksum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cksum.c b/cksum.c index 59a4f88..e931c6e 100644 --- a/cksum.c +++ b/cksum.c @@ -94,6 +94,7 @@ int main(int argc, char *argv[]) { FILE *fp; + int ret = 0; ARGBEGIN { default: @@ -106,6 +107,7 @@ main(int argc, char *argv[]) for (; *argv; argc--, argv++) { if (!(fp = fopen(*argv, "r"))) { weprintf("fopen %s:", *argv); + ret = 1; continue; } cksum(fp, *argv); @@ -113,5 +115,5 @@ main(int argc, char *argv[]) } } - return 0; + return ret; }