diff options
author | guenther <> | 2012-11-10 03:46:11 +0000 |
---|---|---|
committer | guenther <> | 2012-11-10 03:46:11 +0000 |
commit | 09f7cf44d9e90e3122800af8160365f64d33dd83 (patch) | |
tree | de7caebb9a7c7aa4d9cfb94221f2343a2b420078 | |
parent | cc27290cd0ac9c8a750e38719b5dff3cb0219726 (diff) | |
download | openbsd-09f7cf44d9e90e3122800af8160365f64d33dd83.tar.gz openbsd-09f7cf44d9e90e3122800af8160365f64d33dd83.tar.bz2 openbsd-09f7cf44d9e90e3122800af8160365f64d33dd83.zip |
Per POSIX, fix raise() and abort() to send the signal to the current thread.
Should make coredumps from abort() easier to debug too.
ok kurt@
-rw-r--r-- | src/lib/libc/stdlib/abort.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/abort.c b/src/lib/libc/stdlib/abort.c index 244e3b28aa..4c8dc70a1d 100644 --- a/src/lib/libc/stdlib/abort.c +++ b/src/lib/libc/stdlib/abort.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: abort.c,v 1.15 2007/09/03 14:40:16 millert Exp $ */ | 1 | /* $OpenBSD: abort.c,v 1.16 2012/11/10 03:46:11 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1985 Regents of the University of California. | 3 | * Copyright (c) 1985 Regents of the University of California. |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -34,6 +34,8 @@ | |||
34 | #include "thread_private.h" | 34 | #include "thread_private.h" |
35 | #include "atexit.h" | 35 | #include "atexit.h" |
36 | 36 | ||
37 | int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *); | ||
38 | |||
37 | void | 39 | void |
38 | abort(void) | 40 | abort(void) |
39 | { | 41 | { |
@@ -65,7 +67,7 @@ abort(void) | |||
65 | } | 67 | } |
66 | } | 68 | } |
67 | 69 | ||
68 | (void)kill(getpid(), SIGABRT); | 70 | (void)raise(SIGABRT); |
69 | 71 | ||
70 | /* | 72 | /* |
71 | * if SIGABRT ignored, or caught and the handler returns, do | 73 | * if SIGABRT ignored, or caught and the handler returns, do |
@@ -73,6 +75,6 @@ abort(void) | |||
73 | */ | 75 | */ |
74 | (void)signal(SIGABRT, SIG_DFL); | 76 | (void)signal(SIGABRT, SIG_DFL); |
75 | (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); | 77 | (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); |
76 | (void)kill(getpid(), SIGABRT); | 78 | (void)raise(SIGABRT); |
77 | _exit(1); | 79 | _exit(1); |
78 | } | 80 | } |