summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2020-06-04 16:55:52 +0200
committerJan Synacek <jsynacek@redhat.com>2020-06-04 16:56:49 +0200
commit65a066aae68744e889c114cee56dff5b48d872df (patch)
treec34d0fec32331bfef1d6bb147e405ea2a1907efb
parent242273e1afd456e86ebc48d7d601cb28297f8efb (diff)
downloadsystemd-239-32.tar.gz
seccomp: fix __NR__sysctl usagev239-32
Loosely based on https://github.com/systemd/systemd/pull/14032 and https://github.com/systemd/systemd/pull/14268. Related: #1843871
-rw-r--r--src/test/test-seccomp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c
index 4021a06e0e..009a2e1922 100644
--- a/src/test/test-seccomp.c
+++ b/src/test/test-seccomp.c
@@ -237,14 +237,14 @@ static void test_protect_sysctl(void) {
assert_se(pid >= 0);
if (pid == 0) {
-#if __NR__sysctl > 0
+#if defined __NR__sysctl && __NR__sysctl >= 0
assert_se(syscall(__NR__sysctl, NULL) < 0);
assert_se(errno == EFAULT);
#endif
assert_se(seccomp_protect_sysctl() >= 0);
-#if __NR__sysctl > 0
+#if defined __NR__sysctl && __NR__sysctl >= 0
assert_se(syscall(__NR__sysctl, 0, 0, 0) < 0);
assert_se(errno == EPERM);
#endif