This is the mail archive of the libc-hacker@sourceware.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]

A patch for linuxthreads


Hi,

Here is a patch for linuxthreads.


-- 
H.J. Lu (hjl@gnu.org)
---
Sat Aug  8 11:18:52 1998  H.J. Lu  (hjl@gnu.org)

	* signals.c (sigaction): Handle NULL argument.

Index: signals.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/linuxthreads/signals.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 signals.c
--- signals.c	1998/07/30 18:36:36	1.1.1.3
+++ signals.c	1998/08/08 18:10:18
@@ -93,16 +93,24 @@ int sigaction(int sig, const struct siga
               struct sigaction * oact)
 {
   struct sigaction newact;
+  struct sigaction *newactp;
 
   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;
+      newactp = &newact;
+    }
+  else
+    newactp = NULL;
+  if (__sigaction(sig, newactp, 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]