summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/nginx.c18
-rw-r--r--src/core/ngx_config.h2
-rw-r--r--src/core/ngx_connection.c51
-rw-r--r--src/core/ngx_connection.h1
4 files changed, 59 insertions, 13 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 634035637..fe78ab4e6 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -377,8 +377,11 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"can not respawn %s",
ngx_processes[i].name);
+ continue;
}
+ live = 1;
+
continue;
}
@@ -443,7 +446,7 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
if (ngx_reopen) {
if (ngx_process == NGX_PROCESS_MASTER) {
- if (ccf->worker_reopen > 0) {
+ if (ccf->worker_reopen != 0) {
signo = ngx_signal_value(NGX_REOPEN_SIGNAL);
ngx_reopen = 0;
@@ -461,7 +464,7 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
"reopening logs");
ngx_reopen_files(cycle,
- ccf->worker_reopen > 0 ? ccf->user : -1);
+ ccf->worker_reopen != 0 ? ccf->user : (uid_t) -1);
}
}
@@ -574,6 +577,17 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
}
}
+#if (HAVE_PR_SET_DUMPABLE)
+
+ /* allow coredump after setuid() in Linux 2.4.x */
+
+ if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ "prctl(PR_SET_DUMPABLE) failed");
+ }
+
+#endif
+
sigemptyset(&set);
if (sigprocmask(SIG_SETMASK, &set, NULL) == -1) {
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index b691c3ca9..83f410a61 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -2,7 +2,7 @@
#define _NGX_CONFIG_H_INCLUDED_
-#if 1
+#if 0
/* STUB to allocate a big ngx_connections */
#undef FD_SETSIZE
#define FD_SETSIZE 5000
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 8833c2bce..e0b24fa63 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -48,11 +48,6 @@ ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle)
return NGX_ERROR;
}
-/* STUB: autoconf & set sin_len in ls[i].sockaddr in ngx_http.c */
-#if __FreeBSD__
- addr_in->sin_len = 0;
-#endif
-
ls[i].family = addr_in->sin_family;
ls[i].addr_text.len = ngx_sock_ntop(ls[i].family, ls[i].sockaddr,
ls[i].addr_text.data,
@@ -68,11 +63,11 @@ ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle)
ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle)
{
- int tries, failed, reuseaddr, i;
- ngx_err_t err;
- ngx_log_t *log;
- ngx_socket_t s;
- ngx_listening_t *ls;
+ ngx_int_t tries, failed, reuseaddr, i;
+ ngx_err_t err;
+ ngx_log_t *log;
+ ngx_socket_t s;
+ ngx_listening_t *ls;
reuseaddr = 1;
#if (NGX_SUPPRESS_WARN)
@@ -241,3 +236,39 @@ void ngx_close_listening_sockets(ngx_cycle_t *cycle)
cycle->connections[fd].fd = -1;
}
}
+
+
+ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
+{
+ ngx_int_t level;
+
+ if (err == NGX_ECONNRESET
+ && c->read->log_error == NGX_ERROR_IGNORE_ECONNRESET)
+ {
+ return 0;
+ }
+
+ if (err == NGX_ECONNRESET || err == NGX_EPIPE || err == NGX_ENOTCONN) {
+
+ switch (c->read->log_error) {
+
+ case NGX_ERROR_INFO:
+ level = NGX_LOG_INFO;
+ break;
+
+ case NGX_ERROR_ERR:
+ level = NGX_LOG_ERR;
+ break;
+
+ default:
+ level = NGX_LOG_CRIT;
+ }
+
+ } else {
+ level = NGX_LOG_CRIT;
+ }
+
+ ngx_log_error(level, c->log, err, text);
+
+ return NGX_ERROR;
+}
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index 5f2cc4f8f..6f87fd2d8 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -96,6 +96,7 @@ struct ngx_connection_s {
ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
void ngx_close_listening_sockets(ngx_cycle_t *cycle);
+ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text);
extern ngx_os_io_t ngx_io;