]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: parse_syscall_and_errno() accepts zero errno
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 Mar 2021 02:10:26 +0000 (11:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 Mar 2021 12:22:24 +0000 (21:22 +0900)
src/test/test-seccomp.c

index 6aa91ae8ecb34c01f8341e1d14810a4d3872f19d..b1f917eb54e2503f1dadeff43fdcd5a333355a13 100644 (file)
@@ -72,6 +72,12 @@ static void test_parse_syscall_and_errno(void) {
         assert_se(e == 255);
         n = mfree(n);
 
+        /* 0 is also a valid errno. */
+        assert_se(parse_syscall_and_errno("hoge:0", &n, &e) >= 0);
+        assert_se(streq(n, "hoge"));
+        assert_se(e == 0);
+        n = mfree(n);
+
         assert_se(parse_syscall_and_errno("hoge:kill", &n, &e) >= 0);
         assert_se(streq(n, "hoge"));
         assert_se(e == SECCOMP_ERROR_NUMBER_KILL);