]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: fix some printf format strings
authorRuediger Meier <ruediger.meier@ga-group.nl>
Fri, 7 Apr 2017 11:35:58 +0000 (13:35 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 10 Apr 2017 13:40:58 +0000 (15:40 +0200)
Fix compiler warnings seen on Linux/i586 and OSX/travis.

  #type            #format   #cast
   unsigned long    %lu       -
   uint64_t         PRIu64    -
   fdisk_sector_t   %ju       (uintmax_t)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
libblkid/src/partitions/gpt.c
libfdisk/src/alignment.c
sys-utils/blkzone.c

index b7d050653a9245e7af9cbd571481c761b0be5475..52704ed63aa9e509794a54248ed22840bba44345 100644 (file)
@@ -18,6 +18,7 @@
 #include <stdint.h>
 #include <stddef.h>
 #include <limits.h>
+#include <inttypes.h>
 
 #include "partitions.h"
 #include "crc32.h"
@@ -217,7 +218,7 @@ static struct gpt_header *get_gpt_header(
 
        ssz = blkid_probe_get_sectorsize(pr);
 
-       DBG(LOWPROBE, ul_debug(" checking for GPT header at %ju", lba));
+       DBG(LOWPROBE, ul_debug(" checking for GPT header at %"PRIu64, lba));
 
        /* whole sector is allocated for GPT header */
        h = (struct gpt_header *) get_lba_buffer(pr, lba, ssz);
index 2e206999295283b6e0954e9f31f560252a4bd2c1..327faa03d80733badb371dbb4acf1918479723dc 100644 (file)
@@ -348,7 +348,7 @@ int fdisk_apply_user_device_properties(struct fdisk_context *cxt)
 
                if (cxt->sector_size != old_secsz) {
                        cxt->total_sectors = (old_total * (old_secsz/512)) / (cxt->sector_size >> 9);
-                       DBG(CXT, ul_debugobj(cxt, "new total sectors: %ju", cxt->total_sectors));
+                       DBG(CXT, ul_debugobj(cxt, "new total sectors: %ju", (uintmax_t)cxt->total_sectors));
                }
        }
 
index e2c33770cbd589a9b36eeeb4fcb3634609390146..1457225c964049c616c2ea6633528da8dc63abc0 100644 (file)
@@ -195,7 +195,7 @@ static int blkzone_report(struct blkzone_control *ctl)
                        err(EXIT_FAILURE, _("%s: BLKREPORTZONE ioctl failed"), ctl->devname);
 
                if (ctl->verbose)
-                       printf(_("Found %d zones from 0x%lx\n"),
+                       printf(_("Found %d zones from 0x%"PRIx64"\n"),
                                zi->nr_zones, ctl->offset);
 
                if (!zi->nr_zones) {
@@ -216,7 +216,7 @@ static int blkzone_report(struct blkzone_control *ctl)
                                break;
                        }
 
-                       printf(_("  start: 0x%09lx, len 0x%06lx, wptr 0x%06lx"
+                       printf(_("  start: 0x%09"PRIx64", len 0x%06"PRIx64", wptr 0x%06"PRIx64
                                " reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
                                start, len, (type == 0x1) ? 0 : wp - start,
                                entry->reset, entry->non_seq,
@@ -254,7 +254,7 @@ static int blkzone_reset(struct blkzone_control *ctl)
 
        if (ctl->offset & (zonesize - 1))
                errx(EXIT_FAILURE, _("%s: offset %" PRIu64 " is not aligned "
-                       "to zone size %" PRIu64),
+                       "to zone size %lu"),
                        ctl->devname, ctl->offset, zonesize);
 
        if (ctl->offset > ctl->total_sectors)
@@ -273,7 +273,7 @@ static int blkzone_reset(struct blkzone_control *ctl)
            (zlen & (zonesize - 1)) &&
            ctl->offset + zlen != ctl->total_sectors)
                errx(EXIT_FAILURE, _("%s: number of sectors %" PRIu64 " is not aligned "
-                       "to zone size %" PRIu64),
+                       "to zone size %lu"),
                        ctl->devname, ctl->length, zonesize);
 
        za.sector = ctl->offset;