X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-sigaction.c;h=c06e6f72772e1a14196d999a2e191c1e36666ad9;hb=a2c5f8d99ec52594aae96afeb29e0aeb7a841872;hp=9ef3352f4964e2150d17056cb7cfd7dbb6016f27;hpb=e9d840af0a8dbb1d1f46205177dd57453b579830;p=gnulib.git diff --git a/tests/test-sigaction.c b/tests/test-sigaction.c index 9ef3352f4..c06e6f727 100644 --- a/tests/test-sigaction.c +++ b/tests/test-sigaction.c @@ -53,7 +53,7 @@ provide other flags as extensions, such as SA_RESTORER, that we must ignore in this test. */ #define MASK_SA_FLAGS (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART \ - SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER) + | SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER) /* This test is unsafe in the presence of an asynchronous SIGABRT, because we install a signal-handler that is intentionally not @@ -76,7 +76,12 @@ handler (int sig) ASSERT (sa.sa_handler == handler); break; case 1: + /* This assertion fails on glibc-2.3.6 systems with LinuxThreads, + when this program is linked with -lpthread, due to the sigaction() + override in libpthread.so. */ +#if !defined __GLIBC__ ASSERT (sa.sa_handler == SIG_DFL); +#endif break; default: ASSERT (0); @@ -89,24 +94,31 @@ main (int argc, char *argv[]) struct sigaction sa; struct sigaction old_sa; sa.sa_handler = handler; + sa.sa_flags = 0; ASSERT (sigemptyset (&sa.sa_mask) == 0); ASSERT (sigaction (SIGABRT, &sa, NULL) == 0); ASSERT (raise (SIGABRT) == 0); + sa.sa_flags = SA_RESETHAND | SA_NODEFER; ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0); ASSERT ((old_sa.sa_flags & MASK_SA_FLAGS) == 0); ASSERT (old_sa.sa_handler == handler); ASSERT (raise (SIGABRT) == 0); + sa.sa_handler = SIG_DFL; ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0); ASSERT ((old_sa.sa_flags & SA_SIGINFO) == 0); +#if !defined __GLIBC__ /* see above */ ASSERT (old_sa.sa_handler == SIG_DFL); +#endif + sa.sa_handler = SIG_IGN; ASSERT (sigaction (SIGABRT, &sa, NULL) == 0); ASSERT (raise (SIGABRT) == 0); ASSERT (sigaction (SIGABRT, NULL, &old_sa) == 0); ASSERT (old_sa.sa_handler == SIG_IGN); ASSERT (raise (SIGABRT) == 0); + return 0; }