netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nftables 1/2] src: use PRIu64 format
@ 2021-05-18 12:34 Pablo Neira Ayuso
  2021-05-18 12:34 ` [PATCH nftables 2/2] datatype: skip cgroupv2 rootfs in listing Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-05-18 12:34 UTC (permalink / raw)
  To: netfilter-devel

Fix the following compilation warnings on x86_32.

datatype.c: In function ‘cgroupv2_type_print’:
datatype.c:1387:22: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
   nft_print(octx, "%lu", id);
                    ~~^   ~~
                    %llu

meta.c: In function ‘date_type_print’:
meta.c:411:21: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
  nft_print(octx, "%lu", tstamp);
                   ~~^   ~~~~~~
                   %llu

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/datatype.c | 2 +-
 src/meta.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/datatype.c b/src/datatype.c
index c4e66c4633f8..743505de44b6 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -1384,7 +1384,7 @@ static void cgroupv2_type_print(const struct expr *expr,
 	if (cgroup_path)
 		nft_print(octx, "\"%s\"", cgroup_path);
 	else
-		nft_print(octx, "%lu", id);
+		nft_print(octx, "%" PRIu64, id);
 
 	xfree(cgroup_path);
 }
diff --git a/src/meta.c b/src/meta.c
index 73d58b1f53b5..fdbeba26291a 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -408,7 +408,7 @@ static void date_type_print(const struct expr *expr, struct output_ctx *octx)
 	 * Do our own printing. The default print function will print in
 	 * nanoseconds, which is ugly.
 	 */
-	nft_print(octx, "%lu", tstamp);
+	nft_print(octx, "%" PRIu64, tstamp);
 }
 
 static time_t parse_iso_date(const char *sym)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH nftables 2/2] datatype: skip cgroupv2 rootfs in listing
  2021-05-18 12:34 [PATCH nftables 1/2] src: use PRIu64 format Pablo Neira Ayuso
@ 2021-05-18 12:34 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-05-18 12:34 UTC (permalink / raw)
  To: netfilter-devel

cgroupv2 path is expressed from the /sys/fs/cgroup, update listing
to skip the rootfs.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/datatype.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/datatype.c b/src/datatype.c
index 743505de44b6..7267d60895d8 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -1382,7 +1382,8 @@ static void cgroupv2_type_print(const struct expr *expr,
 
 	cgroup_path = cgroupv2_get_path(SYSFS_CGROUPSV2_PATH, id);
 	if (cgroup_path)
-		nft_print(octx, "\"%s\"", cgroup_path);
+		nft_print(octx, "\"%s\"",
+			  &cgroup_path[strlen(SYSFS_CGROUPSV2_PATH) + 1]);
 	else
 		nft_print(octx, "%" PRIu64, id);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-18 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-18 12:34 [PATCH nftables 1/2] src: use PRIu64 format Pablo Neira Ayuso
2021-05-18 12:34 ` [PATCH nftables 2/2] datatype: skip cgroupv2 rootfs in listing Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).