diff src/core/ngx_cycle.c @ 227:2ba3477070ac

nginx-0.0.1-2004-01-14-21:19:42 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 14 Jan 2004 18:19:42 +0000
parents 4f81b931e9ff
children 86e473b5641e
line wrap: on
line diff
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -138,8 +138,6 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
                                    NGX_FILE_RDWR,
                                    NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
 
-ngx_log_debug(log, "OPEN: %d:%s" _ file[i].fd _ file[i].name.data);
-
         if (file[i].fd == NGX_INVALID_FILE) {
             ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
                           ngx_open_file_n " \"%s\" failed",
@@ -156,6 +154,14 @@ ngx_log_debug(log, "OPEN: %d:%s" _ file[
             failed = 1;
             break;
         }
+#else
+        if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {
+            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+                          "fcntl(FD_CLOEXEC) \"%s\" failed",
+                          file[i].name.data);
+            failed = 1;
+            break;
+        }
 #endif
     }
 
@@ -631,6 +637,20 @@ void ngx_reopen_files(ngx_cycle_t *cycle
 
             continue;
         }
+#else
+        if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
+            ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+                          "fcntl(FD_CLOEXEC) \"%s\" failed",
+                          file[i].name.data);
+
+            if (ngx_close_file(fd) == NGX_FILE_ERROR) {
+                ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+                              ngx_close_file_n " \"%s\" failed",
+                              file[i].name.data);
+            }
+
+            continue;
+        }
 #endif
 
         if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {