Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions testsuite/tests/rts/exec_signals_child.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
#include <stdio.h>
#include <errno.h>

// Prints the state of the signal handlers to stdout
int main()
// Prints the state of the signal handlers to stdout.
// NOTE: We intentionally start at signal 1 (not 0). Signal number 0 is not a
// real signal; passing 0 to sigismember/sigaction is undefined behaviour and
// on Darwin was observed to yield memory corruption / junk bytes in output.
int main(void)
{
int open = 0, i;
sigset_t blockedsigs;

printf("ChildInfo { masked = [");

sigprocmask(SIG_BLOCK, NULL, &blockedsigs);
for(i = 0; i < NSIG; ++i)
for(i = 1; i < NSIG; ++i)
{
int ret = sigismember(&blockedsigs, i);
if(ret >= 0)
Expand All @@ -26,7 +29,7 @@ int main()
printf("], handlers = [");

open = 0;
for(i = 0; i < NSIG; ++i)
for(i = 1; i < NSIG; ++i)
{
struct sigaction old;
if(sigaction(i, NULL, &old) >= 0)
Expand Down