diff mbox series

[iptables,03/14] extensions: recent: Fix format string for unsigned values

Message ID 20240727213648.28761-4-phil@nwl.cc
State Accepted
Delegated to: Phil Sutter
Headers show
Series Some fixes and trivial improvements | expand

Commit Message

Phil Sutter July 27, 2024, 9:36 p.m. UTC
Both fields 'seconds' and 'hit_count' are unsigned, use '%u'
accordingly. While being at it, also fix coding-style in those lines.

Basically a day-1 bug, have Fixes: point at a reasonably old commit.

Fixes: af1660fe0e88c ("Move libipt_recent to libxt_recent")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 extensions/libxt_recent.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/extensions/libxt_recent.c b/extensions/libxt_recent.c
index 055ae35080346..0221d4462408f 100644
--- a/extensions/libxt_recent.c
+++ b/extensions/libxt_recent.c
@@ -193,10 +193,12 @@  static void recent_print(const void *ip, const struct xt_entry_match *match,
 		printf(" UPDATE");
 	if (info->check_set & XT_RECENT_REMOVE)
 		printf(" REMOVE");
-	if(info->seconds) printf(" seconds: %d", info->seconds);
+	if (info->seconds)
+		printf(" seconds: %u", info->seconds);
 	if (info->check_set & XT_RECENT_REAP)
 		printf(" reap");
-	if(info->hit_count) printf(" hit_count: %d", info->hit_count);
+	if (info->hit_count)
+		printf(" hit_count: %u", info->hit_count);
 	if (info->check_set & XT_RECENT_TTL)
 		printf(" TTL-Match");
 	printf(" name: %s", info->name);
@@ -233,10 +235,12 @@  static void recent_save(const void *ip, const struct xt_entry_match *match,
 		printf(" --update");
 	if (info->check_set & XT_RECENT_REMOVE)
 		printf(" --remove");
-	if(info->seconds) printf(" --seconds %d", info->seconds);
+	if (info->seconds)
+		printf(" --seconds %u", info->seconds);
 	if (info->check_set & XT_RECENT_REAP)
 		printf(" --reap");
-	if(info->hit_count) printf(" --hitcount %d", info->hit_count);
+	if (info->hit_count)
+		printf(" --hitcount %u", info->hit_count);
 	if (info->check_set & XT_RECENT_TTL)
 		printf(" --rttl");
 	printf(" --name %s",info->name);