]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
ipset: fix print format warning
authorNeutron Soutmun <neo.neutron@gmail.com>
Mon, 18 Jan 2021 04:58:30 +0000 (11:58 +0700)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Tue, 19 Jan 2021 08:00:10 +0000 (09:00 +0100)
* Use PRIx64 for portablility over various architectures.
* The format string for the 64bit number printing is incorrect,
  the `%` sign is missing.
* The force types casting over the uint32_t and uint64_t are unnecessary
  which warned by the compiler on different architecture.

Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
lib/print.c

index 0d86a98b36b9479608130f17fcaa9dcce5034436..a7ffd810bb1cb5046d0e94687ffe67a5313859e1 100644 (file)
@@ -431,10 +431,10 @@ ipset_print_hexnumber(char *buf, unsigned int len,
                                *(const uint16_t *) number);
        else if (maxsize == sizeof(uint32_t))
                return snprintf(buf, len, "0x%08"PRIx32,
-                               (long unsigned) *(const uint32_t *) number);
+                               *(const uint32_t *) number);
        else if (maxsize == sizeof(uint64_t))
-               return snprintf(buf, len, "0x016lx",
-                               (long long unsigned) *(const uint64_t *) number);
+               return snprintf(buf, len, "0x%016"PRIx64,
+                               *(const uint64_t *) number);
        else
                assert(0);
        return 0;