This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

sigaction


>Submitter-Id:	net
>Originator:	Marc Lehmann
>Organization:
>Confidential:	no
>Synopsis:	segfault in sigaction.
>Severity:	serious
>Priority:	low
>Category:	libc
>Class:		sw-bug
>Release:	libc-2.0.94
>Environment:
	
Host type: i686-pc-linux-gnu
System: Linux cerebro 2.1.120 #46 SMP Sat Sep 5 23:52:04 CEST 1998 i686
Architecture: i686

Addons: linuxthreads crypt

Build CC: gcc
Compiler version: pgcc-2.91.57 19980901 (egcs-1.1 release)
Kernel headers: 2.1.121
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: no
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio

>Description:
linuxthreads/sigaction.c doesn't like the new action handler argument being 0.
>How-To-Repeat:
sigaction (anything, 0, anything); will segfault
>Fix:
This patch fixes it. And perl finally passes the testsuite.

1998-09-11  Marc Lehmann <pcg@goof.com>

	* linuxthreads/signals.c (sigaction): allow for "act" being null.

--- linuxthreads/signals.c.old  Fri Sep 11 03:30:27 1998
+++ linuxthreads/signals.c      Fri Sep 11 03:53:20 1998
@@ -96,13 +96,19 @@
 
   if (sig == PTHREAD_SIG_RESTART || sig == PTHREAD_SIG_CANCEL)
     return EINVAL;
-  newact = *act;
-  if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL)
-    newact.sa_handler = pthread_sighandler;
-  if (__sigaction(sig, &newact, oact) == -1)
+  
+  if (act)
+    {
+      newact = *act;
+      if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL)
+        newact.sa_handler = pthread_sighandler;
+    }
+  
+  if (__sigaction(sig, act ? &newact : 0, oact) == -1)
     return -1;
   if (oact != NULL) oact->sa_handler = sighandler[sig];
-  sighandler[sig] = act->sa_handler;
+  if (act)
+    sighandler[sig] = act->sa_handler;
   return 0;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]