Use sigaction instead of signal to restore the previous handler
authorLuca Barbato <lu_zero@gentoo.org>
Sat, 7 Jun 2008 17:38:01 +0000 (19:38 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 7 Jun 2008 17:38:01 +0000 (19:38 +0200)
pixman/pixman-pict.c

index 948c66603118e425c123f288f71a5e387788016d..e49a86406d5e7b6bdde3a855fe7b95c4a7c74ade 100644 (file)
@@ -1923,15 +1923,19 @@ pixman_bool_t pixman_have_vmx (void) {
 #else
 #include <signal.h>
 
-static void vmx_test (int sig) {
+static void vmx_test(int sig, siginfo_t *si, void *unused) {
     have_vmx = FALSE;
 }
 
 pixman_bool_t pixman_have_vmx (void) {
+    struct sigaction sa, osa;
     if (!initialized) {
-        signal(SIGILL, vmx_test);
+        sa.sa_flags = SA_SIGINFO;
+        sigemptyset(&sa.sa_mask);
+        sa.sa_sigaction = vmx_test;
+        sigaction(SIGILL, &sa, &osa);
         asm volatile ( "vor 0, 0, 0" );
-        signal(SIGILL, SIG_DFL);
+        sigaction(SIGILL, &osa, NULL);
         initialized = TRUE;
     }
     return have_vmx;