Skip to contentSkip to conversation

extensions: libxt_hashlimit: fix 64-bit printf format

PATCH Superseded Alin Nastac 2 participants 3 messages May 18, 2017 netfilter

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extensions: libxt_hashlimit: fix 64-bit printf format

Furthermore, this extension use a mix of PRIu64 and %llu formats for uint64_t values. IMO it should use only one, for the sake of consistency.

---
 extensions/libxt_hashlimit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extensions/libxt_hashlimit.c +1 -1
index 9e63e1e..21b7aaa 100644
@@ -942,7 +942,7 @@ static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg,
 		    _rates[i].mult / avg < _rates[i].mult % avg)
 			break;
 
-	xt_xlate_add(xl, " %llu/%s burst %lu packets",
+	xt_xlate_add(xl, " %llu/%s burst "PRIu64" packets",
 		     _rates[i-1].mult / avg, _rates[i-1].name, burst);
 }
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 13 lines · Alin Nastac

Furthermore, this extension use a mix of PRIu64 and %llu formats for uint64_t values. IMO it should use only one, for the sake of consistency.

---
 extensions/libxt_hashlimit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extensions/libxt_hashlimit.c +0 -0
index 9e63e1e..21b7aaa 100644

extensions/libxt_hashlimit.c static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg, · line 945

Quoted 5 lines
extensions/libxt_hashlimit.c +1 -1
@@ -942,7 +942,7 @@ static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg,
 		    _rates[i].mult / avg < _rates[i].mult % avg)
 			break;
 
-	xt_xlate_add(xl, " %llu/%s burst %lu packets",
+	xt_xlate_add(xl, " %llu/%s burst "PRIu64" packets",

^
missing % here?

#2 lore raw
Quoted 17 lines · Pablo Neira Ayuso
Quoted 16 lines · Alin Nastac

Furthermore, this extension use a mix of PRIu64 and %llu formats for uint64_t values. IMO it should use only one, for the sake of consistency.

---
 extensions/libxt_hashlimit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extensions/libxt_hashlimit.c +0 -0
index 9e63e1e..21b7aaa 100644
@@ -942,7 +942,7 @@ static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg,
 		    _rates[i].mult / avg < _rates[i].mult % avg)
 			break;
 
Quoted 4 lines

extensions/libxt_hashlimit.c static void print_packets_rate_xlate(struct xt_xlate *xl, uint64_t avg, · line 945

Quoted 2 lines
extensions/libxt_hashlimit.c +1 -1
-	xt_xlate_add(xl, " %llu/%s burst %lu packets",
+	xt_xlate_add(xl, " %llu/%s burst "PRIu64" packets",

^
missing % here?

OK, please revamp, thanks.