glib/tests/unix: Disable the alternate signal stack using SS_DISABLE

In other unix implementations other than linux, sigaltstack can't use a
NULL pointer for old_stack, so let's use SS_DISABLE instead to disable
the alternate stack.

Co-Authored-By: Marco Trevisan <mail@3v1n0.net>
This commit is contained in:
John Ralls 2024-04-15 17:12:57 +02:00 committed by Marco Trevisan (Treviño)
parent 8c842792a9
commit 035c318324

View File

@ -593,7 +593,14 @@ test_signal_alternate_stack (int signal)
*/
g_assert_cmpint (memcmp (stack_memory, zero_mem, MINSIGSTKSZ), !=, 0);
g_assert_no_errno (sigaltstack (&old_stack, NULL));
memset (stack_memory, 0, MINSIGSTKSZ);
g_assert_cmpmem (stack_memory, MINSIGSTKSZ, zero_mem, MINSIGSTKSZ);
stack.ss_flags = SS_DISABLE;
g_assert_no_errno (sigaltstack (&stack, &old_stack));
test_signal (signal);
g_assert_cmpmem (stack_memory, MINSIGSTKSZ, zero_mem, MINSIGSTKSZ);
#endif
}