Previously, 'cksum *' would exit early if * contained a directory
or any other file causing a read error.
---
 cksum.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cksum.c b/cksum.c
index 3355b4c..3b4f4f8 100644
--- a/cksum.c
+++ b/cksum.c
@@ -71,8 +71,10 @@ cksum(FILE *fp, const char *s)
                        ck = (ck << 8) ^ crctab[(ck >> 24) ^ buf[i]];
                len += n;
        }
-       if (ferror(fp))
-               eprintf("fread %s:", s ? s : "<stdin>");
+       if (ferror(fp)) {
+               weprintf("fread %s:", s ? s : "<stdin>");
+               return;
+       }
 
        for (i = len; i; i >>= 8)
                ck = (ck << 8) ^ crctab[(ck >> 24) ^ (i & 0xFF)];
-- 
2.3.5


Reply via email to