aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_posix_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_posix_init.c')
-rw-r--r--src/os/unix/ngx_posix_init.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index c97083333..7462dcfc4 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -13,8 +13,8 @@ void ngx_rotate_signal_handler(int signo);
int ngx_posix_init(ngx_log_t *log)
{
- struct sigaction sa;
- struct rlimit rlmt;
+ struct rlimit rlmt;
+ struct sigaction sa;
ngx_memzero(&sa, sizeof(struct sigaction));
sa.sa_handler = SIG_IGN;
@@ -25,6 +25,15 @@ int ngx_posix_init(ngx_log_t *log)
return NGX_ERROR;
}
+ ngx_memzero(&sa, sizeof(struct sigaction));
+ sa.sa_handler = ngx_sigchld_handler;
+ sigemptyset(&sa.sa_mask);
+ if (sigaction(SIGCHLD, &sa, NULL) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ "sigaction(SIGCHLD) failed");
+ return NGX_ERROR;
+ }
+
sa.sa_handler = ngx_restart_signal_handler;
if (sigaction(ngx_signal_value(NGX_RESTART_SIGNAL), &sa, NULL) == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,