Browse Source

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@
OPENBSD_5_3
guenther 12 years ago
parent
commit
b4d2adfe76
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      src/lib/libc/stdlib/abort.c

+ 5
- 3
src/lib/libc/stdlib/abort.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: abort.c,v 1.15 2007/09/03 14:40:16 millert Exp $ */
/* $OpenBSD: abort.c,v 1.16 2012/11/10 03:46:11 guenther Exp $ */
/* /*
* Copyright (c) 1985 Regents of the University of California. * Copyright (c) 1985 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -34,6 +34,8 @@
#include "thread_private.h" #include "thread_private.h"
#include "atexit.h" #include "atexit.h"
int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *);
void void
abort(void) abort(void)
{ {
@ -65,7 +67,7 @@ abort(void)
} }
} }
(void)kill(getpid(), SIGABRT);
(void)raise(SIGABRT);
/* /*
* if SIGABRT ignored, or caught and the handler returns, do * if SIGABRT ignored, or caught and the handler returns, do
@ -73,6 +75,6 @@ abort(void)
*/ */
(void)signal(SIGABRT, SIG_DFL); (void)signal(SIGABRT, SIG_DFL);
(void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
(void)kill(getpid(), SIGABRT);
(void)raise(SIGABRT);
_exit(1); _exit(1);
} }

Loading…
Cancel
Save