aboutsummaryrefslogtreecommitdiff
path: root/src/core/nginx.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2002-12-10 18:05:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2002-12-10 18:05:12 +0000
commitb0869056bb4385a6b30fc58c653716c45ed33916 (patch)
tree8522c66320ee59e4671f23058a971d9556d1a6a0 /src/core/nginx.c
parentef259d140f378be8d7936d04038354a93cccb461 (diff)
downloadnginx-b0869056bb4385a6b30fc58c653716c45ed33916.tar.gz
nginx-b0869056bb4385a6b30fc58c653716c45ed33916.zip
nginx-0.0.1-2002-12-10-21:05:12 import
Diffstat (limited to 'src/core/nginx.c')
-rw-r--r--src/core/nginx.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index b2f3f5fba..b33ce293e 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -18,6 +18,7 @@
/* */
+static void ngx_set_signals(ngx_log_t *log);
static void ngx_open_listening_sockets(ngx_log_t *log);
@@ -42,6 +43,8 @@ int main(int argc, char *const *argv)
ngx_pool = ngx_create_pool(16 * 1024, &ngx_log);
/* */
+ ngx_set_signals(&ngx_log);
+
ngx_init_sockets(&ngx_log);
/* TODO: read config */
@@ -70,6 +73,20 @@ int main(int argc, char *const *argv)
return 0;
}
+static void ngx_set_signals(ngx_log_t *log)
+{
+ struct sigaction sa;
+
+ ngx_memzero(&sa, sizeof(struct sigaction));
+ sa.sa_handler = SIG_IGN;
+ sigemptyset(&sa.sa_mask);
+ if (sigaction(SIGPIPE, &sa, NULL) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ "sigaction(SIGPIPE, SIG_IGN) failed");
+ exit(1);
+ }
+}
+
static void ngx_open_listening_sockets(ngx_log_t *log)
{
int times, failed, reuseaddr, i;