git: 5b8f07b12f84 - main - Fix -Wformat errors in pfctl on 32-bit architectures

Dimitry Andric dim at FreeBSD.org
Sun Aug 29 15:31:50 UTC 2021


The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=5b8f07b12f8477f1679013d6b3abdab8d33c7243

commit 5b8f07b12f8477f1679013d6b3abdab8d33c7243
Author:     Dimitry Andric <dim at FreeBSD.org>
AuthorDate: 2021-08-29 15:31:28 +0000
Commit:     Dimitry Andric <dim at FreeBSD.org>
CommitDate: 2021-08-29 15:31:28 +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
---
 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 e9a227630f28..9f955a8b1c96 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-all mailing list