15 __attribute__ ((noinline))
19 asm volatile ("" : "=m" (buf));
23 puts ("second longjmp succeeded");
29 static bool expected_to_fail;
39 static const char msg[] = "unexpected longjmp failure\n";
40 TEMP_FAILURE_RETRY (write (STDOUT_FILENO, msg, sizeof (msg) - 1));
50 sa.sa_handler = handler;
52 sigemptyset (&sa.sa_mask);
54 sigaction (SIGABRT, &sa, NULL);
56 /* Avoid all the buffer overflow messages on stderr. */
57 int fd = open (_PATH_DEVNULL, O_WRONLY);
59 close (STDERR_FILENO);
62 dup2 (fd, STDERR_FILENO);
65 setenv ("LIBC_FATAL_STDERR_", "1", 1);
68 expected_to_fail = false;
74 printf ("first longjmp returned\n");
79 expected_to_fail = true;
84 puts ("second longjmp returned");