git: 2ea6ae7cc814 - stable/12 - Fix -Wformat errors in pfctl on 32-bit architectures

Kristof Provost kp at FreeBSD.org
Mon Sep 6 13:43:30 UTC 2021


The branch stable/12 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ea6ae7cc8146d2c05e266f80f00d35e9dc6dc24

commit 2ea6ae7cc8146d2c05e266f80f00d35e9dc6dc24
Author:     Dimitry Andric <dim at FreeBSD.org>
AuthorDate: 2021-08-29 15:31:28 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-09-06 13:43:03 +0000

    Fix -Wformat errors in pfctl on 32-bit architectures
    
    Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result
    in "error: format specifies type 'unsigned long' but the argument has
    type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit
    architectures.
    
    Fixes:          80078d9d38fd
    MFC after:      1 week
    
    (cherry picked from commit 5b8f07b12f8477f1679013d6b3abdab8d33c7243)
---
 sbin/pfctl/pfctl_parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 5ffb006df8a0..7e48acd2e26c 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -578,7 +578,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts)
 	printf("%-27s %14s %16s\n", "State Table", "Total", "Rate");
 	printf("  %-25s %14" PRIu64 " %14s\n", "current entries", s->states, "");
 	TAILQ_FOREACH(c, &s->fcounters, entry) {
-		printf("  %-25s %14lu ", c->name, c->counter);
+		printf("  %-25s %14" PRIu64 " ", c->name, c->counter);
 		if (runtime > 0)
 			printf("%14.1f/s\n",
 			    (double)c->counter / (double)runtime);
@@ -590,7 +590,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts)
 		printf("  %-25s %14" PRIu64 " %14s\n", "current entries",
 		    s->src_nodes, "");
 		TAILQ_FOREACH(c, &s->scounters, entry) {
-			printf("  %-25s %14lu ", c->name, c->counter);
+			printf("  %-25s %14" PRIu64 " ", c->name, c->counter);
 			if (runtime > 0)
 				printf("%14.1f/s\n",
 				    (double)c->counter / (double)runtime);


More information about the dev-commits-src-branches mailing list