diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-10-25 04:14:00 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-10-25 04:14:00 +0000 |
commit | 4275151b29856276011c49450afe3372c6f3cc0e (patch) | |
tree | 071c33284363009cb01adae056b5ab32ab1aca7b /lib | |
parent | 0ca5b30f7d229392a73b057146945e3d4841e937 (diff) |
Use sigaction() instead of signal() to avoid pulling in unnecessary
wrappers. To keep uses from crawling back in, mark signal() as
deprecated inside libc.
ok deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/signal.c | 3 | ||||
-rw-r--r-- | lib/libc/hidden/signal.h | 4 | ||||
-rw-r--r-- | lib/libc/stdlib/abort.c | 8 |
3 files changed, 8 insertions, 7 deletions
diff --git a/lib/libc/gen/signal.c b/lib/libc/gen/signal.c index 0ca411bca64..c948ef0e5e0 100644 --- a/lib/libc/gen/signal.c +++ b/lib/libc/gen/signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.c,v 1.9 2015/10/23 04:39:24 guenther Exp $ */ +/* $OpenBSD: signal.c,v 1.10 2015/10/25 04:13:59 guenther Exp $ */ /* * Copyright (c) 1985, 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -51,6 +51,5 @@ signal(int s, sig_t a) return (SIG_ERR); return (osa.sa_handler); } -DEF_STRONG(signal); __weak_alias(bsd_signal, signal); diff --git a/lib/libc/hidden/signal.h b/lib/libc/hidden/signal.h index 10bb3e41884..f23578d725d 100644 --- a/lib/libc/hidden/signal.h +++ b/lib/libc/hidden/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.8 2015/10/23 04:39:24 guenther Exp $ */ +/* $OpenBSD: signal.h,v 1.9 2015/10/25 04:13:59 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> * @@ -44,7 +44,7 @@ PROTO_NORMAL(sigemptyset); PROTO_NORMAL(sigfillset); PROTO_DEPRECATED(siginterrupt); PROTO_NORMAL(sigismember); -PROTO_NORMAL(signal); +PROTO_STD_DEPRECATED(signal); PROTO_DEPRECATED(sigpause); PROTO_NORMAL(sigpending); PROTO_WRAP(sigprocmask); diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c index 710cd7da478..129a1735f3b 100644 --- a/lib/libc/stdlib/abort.c +++ b/lib/libc/stdlib/abort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abort.c,v 1.19 2015/10/23 04:39:24 guenther Exp $ */ +/* $OpenBSD: abort.c,v 1.20 2015/10/25 04:13:59 guenther Exp $ */ /* * Copyright (c) 1985 Regents of the University of California. * All rights reserved. @@ -39,7 +39,7 @@ void abort(void) { sigset_t mask; - + struct sigaction sa; sigfillset(&mask); /* @@ -55,7 +55,9 @@ abort(void) * if SIGABRT ignored, or caught and the handler returns, do * it again, only harder. */ - (void)signal(SIGABRT, SIG_DFL); + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_DFL; + (void)sigaction(SIGABRT, &sa, NULL); (void)sigprocmask(SIG_SETMASK, &mask, NULL); (void)raise(SIGABRT); _exit(1); |