diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-12 00:09:44 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-12 00:55:56 +0100 |
commit | 0c4856250814d5fe1222a39c6954c4b5d79a829c (patch) | |
tree | 17dc918696353023074e35d5e0e7369013a6c385 | |
parent | 0b6ad02b33448c0b8b6fdd781dffad329d1f0f7d (diff) | |
download | glibc-0c4856250814d5fe1222a39c6954c4b5d79a829c.zip glibc-0c4856250814d5fe1222a39c6954c4b5d79a829c.tar.gz glibc-0c4856250814d5fe1222a39c6954c4b5d79a829c.tar.bz2 |
hurd: Cope with signals sent to ourself early
Typically when aborting during initialization, before signals are set
up.
-rw-r--r-- | sysdeps/mach/hurd/kill.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/kill.c b/sysdeps/mach/hurd/kill.c index 1e006ee..8cba3cc 100644 --- a/sysdeps/mach/hurd/kill.c +++ b/sysdeps/mach/hurd/kill.c @@ -17,7 +17,9 @@ #include <errno.h> #include <sys/types.h> +#include <sys/wait.h> #include <signal.h> +#include <unistd.h> #include <hurd.h> #include <hurd/port.h> #include <hurd/signal.h> @@ -34,6 +36,14 @@ __kill (pid_t pid, int sig) mach_port_t proc; struct hurd_userlink ulink; + if (pid == __getpid () && _hurd_msgport == MACH_PORT_NULL) + { + /* We are trying to kill ourself but we have not even initialized our own + msgport yet. Abort by hand. */ + _exit (127); + /* NOTREACHED */ + } + void kill_pid (pid_t pid) /* Kill one PID. */ { /* SIGKILL is not delivered as a normal signal. |