]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix format strings (#2457)
authorGraham Percival <gperciva@tarsnap.com>
Sat, 28 Dec 2024 19:03:17 +0000 (11:03 -0800)
committerGitHub <noreply@github.com>
Sat, 28 Dec 2024 19:03:17 +0000 (11:03 -0800)
cpio/cpio.c
libarchive/archive_read_support_format_zip.c
libarchive/test/test_write_disk_perms.c
tar/util.c
test_utils/test_main.c

index 6bc6eb22e9671282de4aa0953a35501b9e9fade7..2bf1bfa2985a2c25bd071b6ae55bb340d2228dfb 100644 (file)
@@ -1206,7 +1206,7 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
        else
                strcpy(date, "invalid mtime");
 
-       fprintf(out, "%s%3d %-8s %-8s %8s %12s %s",
+       fprintf(out, "%s%3u %-8s %-8s %8s %12s %s",
            archive_entry_strmode(entry),
            archive_entry_nlink(entry),
            uname, gname, size, date,
index e21048b74ae70e1153a31fecadc5bf5163484d2a..27e6bc051f73b29c2cd0a2031e53878b156583b2 100644 (file)
@@ -2134,15 +2134,15 @@ zipx_ppmd8_init(struct archive_read *a, struct zip *zip)
 
        if(order < 2 || restore_method > 2) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
-                   "Invalid parameter set in PPMd8 stream (order=%" PRId32 ", "
-                   "restore=%" PRId32 ")", order, restore_method);
+                   "Invalid parameter set in PPMd8 stream (order=%" PRIu32 ", "
+                   "restore=%" PRIu32 ")", order, restore_method);
                return (ARCHIVE_FAILED);
        }
 
        /* Allocate the memory needed to properly decompress the file. */
        if(!__archive_ppmd8_functions.Ppmd8_Alloc(&zip->ppmd8, mem << 20)) {
                archive_set_error(&a->archive, ENOMEM,
-                   "Unable to allocate memory for PPMd8 stream: %" PRId32 " bytes",
+                   "Unable to allocate memory for PPMd8 stream: %" PRIu32 " bytes",
                    mem << 20);
                return (ARCHIVE_FATAL);
        }
index 4df9f70bd998fe1a4eac8839a28979034a56c5ab..77a15d1a3e420de5e08764a6a18276e063bdd168 100644 (file)
@@ -216,7 +216,7 @@ DEFINE_TEST(test_write_disk_perms)
 
        /* Check original owner. */
        assertEqualInt(0, stat("dir_owner", &st));
-       failure("dir_owner: st.st_uid=%d", st.st_uid);
+       failure("dir_owner: st.st_uid=%jd", (intmax_t)st.st_uid);
        assertEqualInt(st.st_uid, original_uid);
        /* Shouldn't try to edit the owner when no overwrite option is set. */
        assert((ae = archive_entry_new()) != NULL);
@@ -230,7 +230,7 @@ DEFINE_TEST(test_write_disk_perms)
        assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a));
        /* Make sure they're unchanged. */
        assertEqualInt(0, stat("dir_owner", &st));
-       failure("dir_owner: st.st_uid=%d", st.st_uid);
+       failure("dir_owner: st.st_uid=%jd", (intmax_t)st.st_uid);
        assertEqualInt(st.st_uid, original_uid);
 
        /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */
@@ -475,8 +475,8 @@ DEFINE_TEST(test_write_disk_perms)
                assertEqualInt(0, stat("file_bad_owner", &st));
                failure("file_bad_owner: st.st_mode=%o", st.st_mode);
                assertEqualInt(st.st_mode & 07777, 0744);
-               failure("file_bad_owner: st.st_uid=%d getuid()=%d",
-                   st.st_uid, getuid());
+               failure("file_bad_owner: st.st_uid=%jd getuid()=%jd",
+                   (intmax_t)st.st_uid, (intmax_t)getuid());
                /* The entry had getuid()+1, but because we're
                 * not root, we should not have been able to set that. */
                assertEqualInt(st.st_uid, getuid());
index a152f3506994807c2e0bb838696e707fd1940f1d..e91234c926bd9b589bdd7a4b40502530be02c591 100644 (file)
@@ -684,7 +684,7 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
        }
        if (!now)
                time(&now);
-       fprintf(out, "%s %d ",
+       fprintf(out, "%s %u ",
            archive_entry_strmode(entry),
            archive_entry_nlink(entry));
 
index a823de14d587d1dfbe3fbed6df5bf466ec62793b..60b1dc8c69995a26bb5d272f16090169cf87b100 100644 (file)
@@ -3536,7 +3536,7 @@ test_summarize(int failed, int skips_num)
 
        for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
                if (failed_lines[i].count > 1 && !failed_lines[i].skip)
-                       logprintf("%s:%d: Summary: Failed %d times\n",
+                       logprintf("%s:%u: Summary: Failed %d times\n",
                            failed_filename, i, failed_lines[i].count);
        }
        /* Clear the failure history for the next file. */