From 633ad43b19b4e5e26fff16c339f9fdd5293c2ffc Mon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Thu, 2 Apr 2015 10:33:18 +0200
Subject: [PATCH] src: fix compilation warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
libarptc/libarptc.c: In function ‘dump_entry’:
libarptc/libarptc.c:137:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ [-Wformat]
libarptc/libarptc.c:137:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘__u64’ [-Wformat]
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 935acea0326785834b22f2233e1b1e3f8d000f7d)
Signed-off-by: Phil Sutter <psutter@redhat.com>
---
arptables.c | 7 ++++---
libarptc/libarptc.c | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arptables.c b/arptables.c
index 845e226a98a30..f820ffa894e00 100644
--- a/arptables.c
+++ b/arptables.c
@@ -2164,16 +2164,17 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle)
"-%c requires packet and byte counter",
opt2char(OPT_COUNTERS));
- if (sscanf(pcnt, "%"PRIu64, &fw.counters.pcnt) != 1)
+ if (sscanf(pcnt, "%"PRIu64,
+ (uint64_t *)&fw.counters.pcnt) != 1)
exit_error(PARAMETER_PROBLEM,
"-%c packet counter not numeric",
opt2char(OPT_COUNTERS));
- if (sscanf(bcnt, "%"PRIu64, &fw.counters.bcnt) != 1)
+ if (sscanf(bcnt, "%"PRIu64,
+ (uint64_t *)&fw.counters.bcnt) != 1)
exit_error(PARAMETER_PROBLEM,
"-%c byte counter not numeric",
opt2char(OPT_COUNTERS));
-
break;
diff --git a/libarptc/libarptc.c b/libarptc/libarptc.c
index 2dcaaefff5b41..0025a75efc9ea 100644
--- a/libarptc/libarptc.c
+++ b/libarptc/libarptc.c
@@ -134,7 +134,7 @@ dump_entry(STRUCT_ENTRY *e, const TC_HANDLE_T handle)
printf("Flags: %02X\n", e->arp.flags);
printf("Invflags: %02X\n", e->arp.invflags);
printf("Counters: %"PRIu64" packets, %"PRIu64" bytes\n",
- e->counters.pcnt, e->counters.bcnt);
+ (uint64_t)e->counters.pcnt, (uint64_t)e->counters.bcnt);
/*
printf("Cache: %08X ", e->nfcache);
if (e->nfcache & NFC_ALTERED) printf("ALTERED ");
--
2.21.0