diff --git a/src/signal.c b/src/signal.c index 1bb60eb82..9dfb5dc4b 100644 --- a/src/signal.c +++ b/src/signal.c @@ -106,6 +106,13 @@ static void signal_init() { int sig; + /* Need to register the handler for SIGINT explicitly, as we can be + * laucned within the subshell and at background: + * $ (./haproxy -f env4.cfg &). According to POSIX standard + * (2.11. Signals and Error Handling), we will inherit from the subshell + * in this case SIG_IGN signal handler for SIGINT and SIGQUIT. + */ + signal(SIGINT, SIG_DFL); signal_queue_len = 0; memset(signal_queue, 0, sizeof(signal_queue)); memset(signal_state, 0, sizeof(signal_state));