]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cksum: don't exit immediately if a single file overflows
authorPádraig Brady <P@draigBrady.com>
Mon, 15 Mar 2021 13:08:26 +0000 (13:08 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 15 Mar 2021 13:12:29 +0000 (13:12 +0000)
This behavior was introduced in commit FILEUTILS-4_0_44-4-g519b707b4.

* src/cksum.c (cksum_slice8): Only report the overflow, and continue.
* src/cksum_pclmul.c (cksum_pclmul): Likewise.

src/cksum.c
src/cksum_pclmul.c

index f3d41666bddee1c9a1d0c3f31c5c3e289484e3a9..8b8b9b190268d38dfe6a1df2d2236cda56e45e10 100644 (file)
@@ -226,7 +226,10 @@ cksum_slice8 (FILE *fp, const char *file, uint_fast32_t *crc_out,
       uint32_t second = 0;
 
       if (length + bytes_read < length)
-        die (EXIT_FAILURE, 0, _("%s: file too long"), quotef (file));
+        {
+          error (0, EOVERFLOW, _("%s: file too long"), quotef (file));
+          return false;
+        }
       length += bytes_read;
 
       /* Process multiples of 8 bytes */
index 9a1b760fe6ded336b384efcc946f8e4c76af3a4e..e18f17ae77f49f7562a1c075591b7cd4d42c6996 100644 (file)
@@ -21,7 +21,7 @@
 #include <stdint.h>
 #include <x86intrin.h>
 #include "system.h"
-#include "die.h"
+#include "error.h"
 
 /* Number of bytes to read at once.  */
 #define BUFLEN (1 << 16)
@@ -74,7 +74,10 @@ cksum_pclmul (FILE *fp, const char *file, uint_fast32_t *crc_out,
       __m128i xor_crc;
 
       if (length + bytes_read < length)
-        die (EXIT_FAILURE, 0, _("%s: file too long"), quotef (file));
+        {
+          error (0, EOVERFLOW, _("%s: file too long"), quotef (file));
+          return false;
+        }
       length += bytes_read;
 
       datap = (__m128i *)buf;