about summary refs log tree commit diff
path: root/linuxthreads/signals.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-04 21:11:41 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-04 21:11:41 +0000
commit9378784537d0a4cd4e630aa360d0ae838dfcf500 (patch)
treee1607d2c9565d13cc916214f1c4c9a603a0202d3 /linuxthreads/signals.c
parent1c15327821aee947476284374a96c7ebb64dc0d6 (diff)
downloadglibc-9378784537d0a4cd4e630aa360d0ae838dfcf500.tar.gz
glibc-9378784537d0a4cd4e630aa360d0ae838dfcf500.tar.xz
glibc-9378784537d0a4cd4e630aa360d0ae838dfcf500.zip
Update.
2003-11-04  Jakub Jelinek  <jakub@redhat.com>

	* io/ftw.c (ftw_dir): Close dir if callback with FTW_D type returns
	non-zero.
	* io/Makefile (tests): Add bug-ftw4.
	* io/bug-ftw4.c: New test.
Diffstat (limited to 'linuxthreads/signals.c')
-rw-r--r--linuxthreads/signals.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c
index e1f67ab0e8..667754aa37 100644
--- a/linuxthreads/signals.c
+++ b/linuxthreads/signals.c
@@ -78,6 +78,7 @@ int __pthread_sigaction(int sig, const struct sigaction * act,
 {
   struct sigaction newact;
   struct sigaction *newactp;
+  __sighandler_t old = SIG_DFL;
 
   if (sig == __pthread_sig_restart ||
       sig == __pthread_sig_cancel ||
@@ -86,6 +87,8 @@ int __pthread_sigaction(int sig, const struct sigaction * act,
       __set_errno (EINVAL);
       return -1;
     }
+  if (sig > 0 && sig < NSIG)
+    old = (__sighandler_t) __sighandler[sig].old;
   if (act)
     {
       newact = *act;
@@ -96,21 +99,27 @@ int __pthread_sigaction(int sig, const struct sigaction * act,
 	    newact.sa_handler = (__sighandler_t) __pthread_sighandler_rt;
 	  else
 	    newact.sa_handler = (__sighandler_t) __pthread_sighandler;
+	  if (old == SIG_IGN || old == SIG_DFL || old == SIG_ERR)
+	    __sighandler[sig].old = (arch_sighandler_t) act->sa_handler;
 	}
       newactp = &newact;
     }
   else
     newactp = NULL;
   if (__libc_sigaction(sig, newactp, oact) == -1)
-    return -1;
+    {
+      if (act)
+	__sighandler[sig].old = (arch_sighandler_t) old;
+      return -1;
+    }
   if (sig > 0 && sig < NSIG)
     {
       if (oact != NULL
 	  /* We may have inherited SIG_IGN from the parent, so return the
 	     kernel's idea of the signal handler the first time
 	     through.  */
-	  && (__sighandler_t) __sighandler[sig].old != SIG_ERR)
-	oact->sa_handler = (__sighandler_t) __sighandler[sig].old;
+	  && old != SIG_ERR)
+	oact->sa_handler = old;
       if (act)
 	/* For the assignment it does not matter whether it's a normal
 	   or real-time signal.  */