Fix signal handling for services on abort/exit
Change-Id: I970a25ae0dd52f0d928fda376296e7b39e3e17eb
This commit is contained in:
parent
a9f55a2e46
commit
b9674650f1
2 changed files with 8 additions and 2 deletions
|
@ -86,7 +86,6 @@ __fail(const char *msg)
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
struct syslog_data sdata = SYSLOG_DATA_INIT;
|
struct syslog_data sdata = SYSLOG_DATA_INIT;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
#endif
|
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
|
|
||||||
/* Immediately block all signal handlers from running code */
|
/* Immediately block all signal handlers from running code */
|
||||||
|
@ -94,7 +93,6 @@ __fail(const char *msg)
|
||||||
(void)sigdelset(&mask, SIGABRT);
|
(void)sigdelset(&mask, SIGABRT);
|
||||||
(void)sigprocmask(SIG_BLOCK, &mask, NULL);
|
(void)sigprocmask(SIG_BLOCK, &mask, NULL);
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
/* This may fail on a chroot jail... */
|
/* This may fail on a chroot jail... */
|
||||||
syslog_ss(LOG_CRIT, &sdata, "%s", msg);
|
syslog_ss(LOG_CRIT, &sdata, "%s", msg);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -43,6 +43,7 @@ __RCSID("$NetBSD: abort.c,v 1.15 2012/06/08 11:15:26 abs Exp $");
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#if defined(_LIBC)
|
||||||
extern void (*__cleanup)(void);
|
extern void (*__cleanup)(void);
|
||||||
static int aborting = 0;
|
static int aborting = 0;
|
||||||
|
|
||||||
|
@ -82,3 +83,10 @@ abort(void)
|
||||||
(void)raise(SIGABRT);
|
(void)raise(SIGABRT);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void
|
||||||
|
abort(void)
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#endif /* defined(_LIBC) */
|
||||||
|
|
Loading…
Reference in a new issue