nginx-0.0.1-2004-01-14-00:33:59 import
diff --git a/src/os/unix/ngx_os.h b/src/os/unix/ngx_os.h
index 8d9a6de..1616612 100644
--- a/src/os/unix/ngx_os.h
+++ b/src/os/unix/ngx_os.h
@@ -50,7 +50,9 @@
 
 
 extern ngx_int_t    ngx_process;
+extern ngx_pid_t    ngx_new_binary;
 
+extern ngx_int_t    ngx_inherited;
 extern ngx_int_t    ngx_signal;
 extern ngx_int_t    ngx_reap;
 extern ngx_int_t    ngx_quit;
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index d5f28d0..b23dc31 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -42,6 +42,8 @@
       "SIG" ngx_value(NGX_CHANGEBIN_SIGNAL),
       ngx_signal_handler },
 
+    { SIGINT, "SIGINT", ngx_signal_handler },
+
     { SIGCHLD, "SIGCHLD", ngx_signal_handler },
 
     { SIGPIPE, "SIGPIPE, SIG_IGN", SIG_IGN },
@@ -93,10 +95,12 @@
 {
     char            *action;
     struct timeval   tv;
+    ngx_int_t        ignore;
     ngx_err_t        err;
     ngx_signal_t    *sig;
 
     ngx_signal = 1;
+    ignore = 0;
 
     err = ngx_errno;
 
@@ -138,11 +142,31 @@
             break;
 
         case ngx_signal_value(NGX_REOPEN_SIGNAL):
-            ngx_reopen = 1;
-            action = ", reopen logs";
-            break;
+            if (ngx_noaccept) {
+                action = ", ignoring";
+
+            } else {
+                ngx_reopen = 1;
+                action = ", reopen logs";
+                break;
+            }
 
         case ngx_signal_value(NGX_CHANGEBIN_SIGNAL):
+            if ((ngx_inherited && getppid() > 1)
+                || (!ngx_inherited && ngx_new_binary > 0))
+            {
+                /*
+                 * Ignore the signal in the new binary if its parent is
+                 * not the init process, i.e. the old binary's process
+                 * is still running.  Or ingore the signal in the old binary's
+                 * process if the new binary's process is already running.
+                 */
+
+                action = ", ignoring";
+                ignore = 1;
+                break;
+            }
+
             ngx_change_binary = 1;
             action = ", changing binary";
             break;
@@ -189,6 +213,13 @@
     ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
                   "signal %d (%s) received%s", signo, sig->signame, action);
 
+    if (ignore) {
+        ngx_log_error(NGX_LOG_CRIT, ngx_cycle->log, 0,
+                      "the changing binary signal is ignored: "
+                      "you should shutdown or terminate "
+                      "before either old or new binary's process");
+    }
+
     if (signo == SIGCHLD) {
         ngx_process_get_status();
     }
diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c
index 4a80257..f591383 100644
--- a/src/os/unix/ngx_process.c
+++ b/src/os/unix/ngx_process.c
@@ -85,17 +85,10 @@
 }
 
 
-ngx_int_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx)
+ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx)
 {
-    if (ngx_spawn_process(cycle, ngx_exec_proc, ctx, ctx->name,
-                                            NGX_PROCESS_DETACHED) == NGX_ERROR)
-    {
-        ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
-                      "can not spawn %s", ctx->name);
-        return NGX_ERROR;
-    }
-
-    return NGX_OK;
+    return ngx_spawn_process(cycle, ngx_exec_proc, ctx, ctx->name,
+                             NGX_PROCESS_DETACHED);
 }
 
 
@@ -154,6 +147,9 @@
     ngx_uint_t  i;
 
     for (i = 0; i < ngx_last_process; i++) {
+        ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0,
+                       "proc table " PID_T_FMT, ngx_processes[i].pid);
+
         if (ngx_processes[i].exiting || !ngx_processes[i].exited) {
             continue;
         }
diff --git a/src/os/unix/ngx_process.h b/src/os/unix/ngx_process.h
index 1eb545b..5b56509 100644
--- a/src/os/unix/ngx_process.h
+++ b/src/os/unix/ngx_process.h
@@ -46,7 +46,7 @@
 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
                             ngx_spawn_proc_pt proc, void *data,
                             char *name, ngx_int_t respawn);
-ngx_int_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
+ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
 void ngx_signal_processes(ngx_cycle_t *cycle, ngx_int_t signo);
 void ngx_respawn_processes(ngx_cycle_t *cycle);
 void ngx_process_get_status(void);