nginx-0.0.1-2004-01-14-21:19:42 import
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index debcca8..12c053f 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -138,8 +138,6 @@
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 @@
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 @@
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) {