summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-04-10 18:36:02 +0000
committerMiles Bader <miles@gnu.org>1996-04-10 18:36:02 +0000
commit574ce5e4e4460174369ccc765502934058eb3636 (patch)
tree33ed2995cf7017f7eabe4be0f39847fadaa485c0
parentb84095feb437da41966116101deeaba19636ebc4 (diff)
(_hurdsig_longjmp_from_handler): Store MACH_PORT_DEAD in the thread reply-port variable before destroying the signal handler's reply port, to avoid infinite recursion.
-rw-r--r--hurd/sigunwind.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c
index 23309fd0d7..f6d29e1ab0 100644
--- a/hurd/sigunwind.c
+++ b/hurd/sigunwind.c
@@ -1,5 +1,5 @@
/* longjmp cleanup function for unwinding past signal handlers.
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 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
@@ -41,7 +41,15 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
mach_port_t *reply_port =
(mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
if (*reply_port)
- __mach_port_destroy (__mach_task_self (), *reply_port);
+ {
+ mach_port_t port = *reply_port;
+ /* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port
+ not to get another reply port, but avoids mig_dealloc_reply_port
+ trying to deallocate it after the receive fails (which it will,
+ because the reply port will be bogus, regardless). */
+ *reply_port = MACH_PORT_DEAD;
+ __mach_port_destroy (__mach_task_self (), port);
+ }
*reply_port = scp->sc_reply_port;
}