diff src/os/unix/ngx_process.c @ 366:e411b1482ee3

nginx-0.0.7-2004-06-23-19:18:17 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 23 Jun 2004 15:18:17 +0000
parents fd24ba70e1b3
children 537de4dca8ca
line wrap: on
line diff
--- a/src/os/unix/ngx_process.c
+++ b/src/os/unix/ngx_process.c
@@ -65,6 +65,22 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t 
             return NGX_ERROR;
         }
 
+        if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) {
+            ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+                          "fcntl(FD_CLOEXEC) failed while spawning \"%s\"",
+                           name);
+            ngx_close_channel(ngx_processes[s].channel, cycle->log);
+            return NGX_ERROR;
+        }
+
+        if (fcntl(ngx_processes[s].channel[1], F_SETFD, FD_CLOEXEC) == -1) {
+            ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+                          "fcntl(FD_CLOEXEC) failed while spawning \"%s\"",
+                           name);
+            ngx_close_channel(ngx_processes[s].channel, cycle->log);
+            return NGX_ERROR;
+        }
+
         ngx_channel = ngx_processes[s].channel[1];
 
     } else {