Drop SA_SIGINFO, and rename the function to setup_sigurg_handler() without the parameter.
* Drop the SA_SIGINFO flag: This flag implies that we use the three-argument sa_sigaction signal handlers, which is not the case here. (c.f. sigaction(2)) * Remove the "int signal" argument and rename the function: The function was already specific to SIGURG and this is better communicated through a different name. Assisted-by: LLM Signed-off-by: Günther Noack <[email protected]> --- .../selftests/landlock/scoped_signal_test.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/landlock/scoped_signal_test.c b/tools/testing/selftests/landlock/scoped_signal_test.c index 0f88a6af9c72..66fec3822812 100644 --- a/tools/testing/selftests/landlock/scoped_signal_test.c +++ b/tools/testing/selftests/landlock/scoped_signal_test.c @@ -392,7 +392,7 @@ static void handle_sigurg(int sig) signal_received = -1; } -static int setup_signal_handler(int signal) +static int setup_sigurg_handler(void) { struct sigaction sa = { .sa_handler = handle_sigurg, @@ -401,7 +401,7 @@ static int setup_signal_handler(int signal) if (sigemptyset(&sa.sa_mask)) return -1; - sa.sa_flags = SA_SIGINFO | SA_RESTART; + sa.sa_flags = SA_RESTART; return sigaction(SIGURG, &sa, NULL); } @@ -506,7 +506,7 @@ TEST_F(fown, sigurg_socket) EXPECT_EQ(0, close(pipe_parent[1])); EXPECT_EQ(0, close(pipe_child[0])); - ASSERT_EQ(0, setup_signal_handler(SIGURG)); + ASSERT_EQ(0, setup_sigurg_handler()); client_socket = socket(AF_UNIX, SOCK_STREAM, 0); ASSERT_LE(0, client_socket); @@ -612,7 +612,7 @@ TEST(sigio_to_pgid_members) ASSERT_EQ(0, setpgid(0, 0)); /* The non-sandboxed parent is the protected (out-of-domain) target. */ - ASSERT_EQ(0, setup_signal_handler(SIGURG)); + ASSERT_EQ(0, setup_sigurg_handler()); signal_received = 0; ASSERT_EQ(0, pipe2(trigger, O_CLOEXEC)); @@ -629,7 +629,7 @@ TEST(sigio_to_pgid_members) EXPECT_EQ(0, close(sync_child[0])); /* In-domain positive control: the child must be signaled. */ - ASSERT_EQ(0, setup_signal_handler(SIGURG)); + ASSERT_EQ(0, setup_sigurg_handler()); signal_received = 0; create_scoped_domain(_metadata, LANDLOCK_SCOPE_SIGNAL); @@ -737,7 +737,7 @@ TEST(sigio_to_pgid_self) ASSERT_EQ(0, setpgid(0, 0)); /* The non-sandboxed thread-group leader is the SIGIO target. */ - ASSERT_EQ(0, setup_signal_handler(SIGURG)); + ASSERT_EQ(0, setup_sigurg_handler()); signal_received = 0; ASSERT_EQ(0, pipe2(trigger, O_CLOEXEC)); @@ -1062,7 +1062,7 @@ TEST_F(trace_fown, deny_scope_fown) EXPECT_EQ(0, close(pipe_parent[1])); EXPECT_EQ(0, close(pipe_child[0])); - ASSERT_EQ(0, setup_signal_handler(SIGURG)); + ASSERT_EQ(0, setup_sigurg_handler()); client_socket = socket(AF_UNIX, SOCK_STREAM, 0); ASSERT_LE(0, client_socket); -- 2.56.0

