1 /* Derived from the test case in
2 https://sourceware.org/bugzilla/show_bug.cgi?id=838. */
10 #include <libc-diag.h>
13 sig_handler (int signum
)
15 pid_t child
= fork ();
18 TEMP_FAILURE_RETRY (waitpid (child
, NULL
, 0));
24 pid_t parent
= getpid ();
26 struct sigaction action
= { .sa_handler
= sig_handler
};
27 sigemptyset (&action
.sa_mask
);
29 DIAG_PUSH_NEEDS_COMMENT
;
30 DIAG_IGNORE_NEEDS_COMMENT (10, "-Wunused-result");
31 /* The result of malloc is deliberately ignored, so do not warn
33 malloc (sizeof (int));
34 DIAG_POP_NEEDS_COMMENT
;
36 if (sigaction (SIGALRM
, &action
, NULL
) != 0)
38 puts ("sigaction failed");
42 /* Create a child that sends the signal to be caught. */
43 pid_t child
= fork ();
46 if (kill (parent
, SIGALRM
) == -1)
51 TEMP_FAILURE_RETRY (waitpid (child
, NULL
, 0));
56 #define TEST_FUNCTION do_test ()
57 #include "../test-skeleton.c"