Skip to contentSkip to conversation

ipset: Fix printf format warning

PATCH In review Neutron Soutmun 2 participants 2 messages Apr 1, 2014 – Apr 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipset: Fix printf format warning

Using PRIx32 macro is portable across multiple architectures and also fix the printf format warning on any architectures that "%llx" is not refer to 32 bits size.

---
 lib/print.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/print.c +2 -1
index f81c074..a7abdcf 100644
@@ -13,6 +13,7 @@
 #include <arpa/inet.h>				/* inet_ntop */
 #include <net/ethernet.h>			/* ETH_ALEN */
 #include <net/if.h>				/* IFNAMSIZ */
+#include <inttypes.h>				/* PRIx macro */
 
 #include <libipset/debug.h>			/* D() */
 #include <libipset/data.h>			/* ipset_data_* */
@@ -519,7 +520,7 @@ ipset_print_mark(char *buf, unsigned int len,
 	mark = ipset_data_get(data, opt);
 	assert(mark);
 
-	size = snprintf(buf, len, "0x%08llx", *mark);
+	size = snprintf(buf, len, "0x%08"PRIx32, *mark);
 	SNPRINTF_FAILURE(size, len, offset);
 
 	return offset;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 3 lines · Neutron Soutmun

Using PRIx32 macro is portable across multiple architectures and also fix the printf format warning on any architectures that "%llx" is not refer to 32 bits size.

Patch is applied, thanks.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary