disable sigchld handler by default #931 (#1182)

* disable sigchld handler by default #931

* update test to set sigchld trap before testing

closes #931
This commit is contained in:
Scott Fennell 2021-08-27 13:48:46 -05:00 committed by GitHub
parent b260bcb85f
commit 167c4a6530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -175,12 +175,12 @@ int Trick::Executive::init_signal_handlers() {
static struct sigaction sigact; static struct sigaction sigact;
/* By default catch SIGBUS, SIGSEGV, SIGABRT, and SIGCHLD. Don't catch SIGFPE */ /* By default catch SIGBUS, SIGSEGV, SIGABRT. Don't catch SIGFPE, SIGCHLD */
set_trap_sigbus(true) ; set_trap_sigbus(true) ;
set_trap_sigfpe(false) ; set_trap_sigfpe(false) ;
set_trap_sigsegv(true) ; set_trap_sigsegv(true) ;
set_trap_sigabrt(true) ; set_trap_sigabrt(true) ;
set_trap_sigchld(true) ; set_trap_sigchld(false) ;
/* Assign ctrl_c_hand() as the default signal handler for SIGINT (<CTRL-C> keypress). */ /* Assign ctrl_c_hand() as the default signal handler for SIGINT (<CTRL-C> keypress). */
sigact.sa_handler = (void (*)(int)) ctrl_c_hand; sigact.sa_handler = (void (*)(int)) ctrl_c_hand;

View File

@ -796,18 +796,19 @@ TEST_F(ExecutiveTest , SetSignalHandlers) {
EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ;
sigaction(SIGSEGV, NULL , &sigact) ; sigaction(SIGSEGV, NULL , &sigact) ;
EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ;
sigaction(SIGCHLD, NULL , &sigact) ;
EXPECT_TRUE( sigact.sa_handler == child_handler ) ;
sigaction(SIGFPE, NULL , &sigact) ; sigaction(SIGFPE, NULL , &sigact) ;
EXPECT_TRUE( sigact.sa_handler == SIG_DFL ) ; EXPECT_TRUE( sigact.sa_handler == SIG_DFL ) ;
exec.set_trap_sigbus(1) ; exec.set_trap_sigbus(1) ;
exec.set_trap_sigsegv(1) ; exec.set_trap_sigsegv(1) ;
exec.set_trap_sigfpe(1) ; exec.set_trap_sigfpe(1) ;
exec.set_trap_sigchld(1) ;
sigaction(SIGBUS, NULL , &sigact) ; sigaction(SIGBUS, NULL , &sigact) ;
EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ;
sigaction(SIGSEGV, NULL , &sigact) ; sigaction(SIGSEGV, NULL , &sigact) ;
EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ;
sigaction(SIGCHLD, NULL , &sigact) ;
EXPECT_TRUE( sigact.sa_handler == child_handler ) ;
sigaction(SIGFPE, NULL , &sigact) ; sigaction(SIGFPE, NULL , &sigact) ;
#if __APPLE__ #if __APPLE__
EXPECT_TRUE( sigact.sa_handler == fpe_sig_handler ) ; EXPECT_TRUE( sigact.sa_handler == fpe_sig_handler ) ;