ipset: fix print format warning
Subsystems (2)
PATCH 1/1 ipset: fix print format warning
* 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.
--- lib/print.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/print.c +3 -3
@@ -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 ;
--
2.30.0
Hi,
Quoted 7 lines · Neutron Soutmun
* 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 theuint32_tanduint64_tare unnecessary which warned by the compiler on different architecture.Signed-off-by Neutron Soutmun <[email protected]>
Thanks, patch is applied in the ipset git tree.
Best regards,
Jozsef
Quoted 23 lines
--- lib/print.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)lib/print.c +3
-4@@ -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 ; --
Quoted 2 lines
2.30.0
-
E-mail : [email protected], [email protected] PGP key : https://wigner.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics
H-1525 Budapest 114, POB. 49, Hungary