summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-08-09 09:02:55 +0000
committerUlrich Drepper <drepper@redhat.com>1998-08-09 09:02:55 +0000
commitcf0fd0161c73af42b7755043fa9a2a0ac0177a08 (patch)
treed99fa841e378df918b60e215b11d2929dd7e8203
parent88187dcc62fc3ca4229bb3e95018fb0f5c1543c2 (diff)
downloadglibc-cf0fd0161c73af42b7755043fa9a2a0ac0177a08.tar.gz
glibc-cf0fd0161c73af42b7755043fa9a2a0ac0177a08.tar.xz
glibc-cf0fd0161c73af42b7755043fa9a2a0ac0177a08.zip
(sigaction): Handle NULL argument.
1998-08-08 11:18  H.J. Lu  <hjl@gnu.org>

	* signals.c (sigaction): Handle NULL argument.
-rw-r--r--linuxthreads/ChangeLog4
-rw-r--r--linuxthreads/signals.c18
2 files changed, 17 insertions, 5 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 26a87cb2c3..c89fa758a3 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,7 @@
+1998-08-08 11:18  H.J. Lu  <hjl@gnu.org>
+
+	* signals.c (sigaction): Handle NULL argument.
+
 1998-08-04  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/unix/sysv/linux/bits/sigthread.h: Use __sigset_t instead
diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c
index ac752d145a..392b5ea5a9 100644
--- a/linuxthreads/signals.c
+++ b/linuxthreads/signals.c
@@ -93,16 +93,24 @@ int sigaction(int sig, const struct sigaction * act,
               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;
 }