diff mbox

[v2] extensions: libxt_hashlimit: fix 64-bit printf formats

Message ID 1495116985-27115-1-git-send-email-alin.nastac@gmail.com
State Changes Requested
Delegated to: Pablo Neira
Headers show

Commit Message

Alin Năstac May 18, 2017, 2:16 p.m. UTC
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.

Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
---
 extensions/libxt_hashlimit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo Neira Ayuso May 23, 2017, 9:11 p.m. UTC | #1
On Thu, May 18, 2017 at 04:16:25PM +0200, Alin Nastac wrote:
> 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.
> 
> Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
> ---
>  extensions/libxt_hashlimit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c
> index 9e63e1e..970bad9 100644
> --- a/extensions/libxt_hashlimit.c
> +++ b/extensions/libxt_hashlimit.c
> @@ -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, " %"PRIu64"/%s burst %"PRIu64" packets",
>  		     _rates[i-1].mult / avg, _rates[i-1].name, burst);

Are there more spots that can be converted in this
extensions/libxt_hashlimit.c file?

I see more %llu in spots for burst. If so, it would be great to fix
them all.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c
index 9e63e1e..970bad9 100644
--- a/extensions/libxt_hashlimit.c
+++ b/extensions/libxt_hashlimit.c
@@ -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, " %"PRIu64"/%s burst %"PRIu64" packets",
 		     _rates[i-1].mult / avg, _rates[i-1].name, burst);
 }