]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cksum: fix tagged output on 32 bit platforms
authorPádraig Brady <P@draigBrady.com>
Tue, 10 Mar 2026 14:47:25 +0000 (14:47 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 10 Mar 2026 16:18:29 +0000 (16:18 +0000)
Fix an unreleased issue due to the recent change
to using idx_t in commit v9.10-91-g02983e493

* src/cksum.c (output_file): Cast the idx_t before passing to printf.

src/cksum.c

index 8bc83cf93b65968a7643c83fc6b1fa829323a24a..79310a0d92b4c93b5b1c976cf536d3edf9a419a7 100644 (file)
@@ -1273,20 +1273,20 @@ output_file (char const *file, int binary_file, void const *digest,
     {
 # if HASH_ALGO_CKSUM
       if (cksum_algorithm == sha2)
-        printf ("SHA%jd", digest_length);
+        printf ("SHA%u", (unsigned int) digest_length);
       else
 # endif
       fputs (DIGEST_TYPE_STRING, stdout);
 # if HASH_ALGO_BLAKE2
       if (digest_length < DIGEST_MAX_LEN * 8)
-        printf ("-%jd", digest_length);
+        printf ("-%u", (unsigned int) digest_length);
 # elif HASH_ALGO_CKSUM
       if (cksum_algorithm == sha3)
-        printf ("-%jd", digest_length);
+        printf ("-%u", (unsigned int) digest_length);
       if (cksum_algorithm == blake2b)
         {
           if (digest_length < DIGEST_MAX_LEN * 8)
-            printf ("-%jd", digest_length);
+            printf ("-%u", (unsigned int) digest_length);
         }
 # endif
       fputs (" (", stdout);