[PATCH] tests: fix format warning in macros

Paul Chaignon paul.chaignon at gmail.com
Sat Sep 21 13:00:51 UTC 2019


tests/prctl-seccomp-filter-v.c (PRINT_ALLOW_SYSCALL, PRINT_DENY_SYSCALL):
Fix format warning.
tests/seccomp-filter-v.c (PRINT_ALLOW_SYSCALL, PRINT_DENY_SYSCALL):
Likewise.

Signed-off-by: Paul Chaignon <paul.chaignon at gmail.com>
---
Two of the Travis CI builds are failing on the master branch because of
this warning.

 tests/prctl-seccomp-filter-v.c |  8 ++++----
 tests/seccomp-filter-v.c       | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/prctl-seccomp-filter-v.c b/tests/prctl-seccomp-filter-v.c
index 6e1affc0..61e0ae3c 100644
--- a/tests/prctl-seccomp-filter-v.c
+++ b/tests/prctl-seccomp-filter-v.c
@@ -43,14 +43,14 @@
 		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)
 
 # define PRINT_ALLOW_SYSCALL(nr) \
-	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
+	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
 	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
-	       __NR_ ## nr)
+	       (long) __NR_ ## nr)
 
 # define PRINT_DENY_SYSCALL(nr, err) \
-	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
+	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
 	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
-	       __NR_ ## nr, err)
+	       (long) __NR_ ## nr, err)
 
 static const struct sock_filter filter[] = {
 	/* load syscall number */
diff --git a/tests/seccomp-filter-v.c b/tests/seccomp-filter-v.c
index f3adce44..f8bd7834 100644
--- a/tests/seccomp-filter-v.c
+++ b/tests/seccomp-filter-v.c
@@ -43,14 +43,14 @@
 		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)
 
 # define PRINT_ALLOW_SYSCALL(nr) \
-	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
-	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
-	       __NR_ ## nr)
+	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
+	        "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
+	        (long) __NR_ ## nr)
 
 # define PRINT_DENY_SYSCALL(nr, err) \
-	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
-	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
-	       __NR_ ## nr, err)
+	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
+	        "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
+	        (long) __NR_ ## nr, err)
 
 static const struct sock_filter filter_c[] = {
 	/* load syscall number */
-- 
2.17.1



More information about the Strace-devel mailing list