aboutsummaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-05-10 12:59:00 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-10 15:57:23 -0700
commitecd0de9a955fd14e825a666ea6785842e1579326 (patch)
treeddd06dc14576fb77c96d90b71be62eb05843f5e3 /hurd
parent6960eb420d7b7cc18420dd68466b664867fa069d (diff)
downloadglibc-ecd0de9a955fd14e825a666ea6785842e1579326.zip
glibc-ecd0de9a955fd14e825a666ea6785842e1579326.tar.gz
glibc-ecd0de9a955fd14e825a666ea6785842e1579326.tar.bz2
Hurd: Fix signal-catching functions.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/catch-signal.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hurd/catch-signal.c b/hurd/catch-signal.c
index 50cd366..3f946e1 100644
--- a/hurd/catch-signal.c
+++ b/hurd/catch-signal.c
@@ -1,5 +1,5 @@
/* Convenience function to catch expected signals during an operation.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,9 +27,12 @@ hurd_catch_signal (sigset_t sigset,
error_t (*operate) (struct hurd_signal_preemptor *),
sighandler_t handler)
{
- jmp_buf buf;
+ /* We need to restore the signal mask, because otherwise the
+ signal-handling code will have blocked the caught signal and for
+ instance calling hurd_catch_signal again would then dump core. */
+ sigjmp_buf buf;
void throw (int signo, long int sigcode, struct sigcontext *scp)
- { longjmp (buf, scp->sc_error ?: EGRATUITOUS); }
+ { siglongjmp (buf, scp->sc_error ?: EGRATUITOUS); }
struct hurd_signal_preemptor preemptor =
{
@@ -40,12 +43,12 @@ hurd_catch_signal (sigset_t sigset,
struct hurd_sigstate *const ss = _hurd_self_sigstate ();
error_t error;
- if (handler == SIG_ERR)
+ if (handler != SIG_ERR)
/* Not our handler; don't bother saving state. */
error = 0;
else
/* This returns again with nonzero value when we preempt a signal. */
- error = setjmp (buf);
+ error = sigsetjmp (buf, 1);
if (error == 0)
{