comparison 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
comparison
equal deleted inserted replaced
226:b0c1e21e68db 227:2ba3477070ac
136 136
137 file[i].fd = ngx_open_file(file[i].name.data, 137 file[i].fd = ngx_open_file(file[i].name.data,
138 NGX_FILE_RDWR, 138 NGX_FILE_RDWR,
139 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND); 139 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
140 140
141 ngx_log_debug(log, "OPEN: %d:%s" _ file[i].fd _ file[i].name.data);
142
143 if (file[i].fd == NGX_INVALID_FILE) { 141 if (file[i].fd == NGX_INVALID_FILE) {
144 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 142 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
145 ngx_open_file_n " \"%s\" failed", 143 ngx_open_file_n " \"%s\" failed",
146 file[i].name.data); 144 file[i].name.data);
147 failed = 1; 145 failed = 1;
150 148
151 #if (WIN32) 149 #if (WIN32)
152 if (ngx_file_append_mode(file[i].fd) == NGX_ERROR) { 150 if (ngx_file_append_mode(file[i].fd) == NGX_ERROR) {
153 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 151 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
154 ngx_file_append_mode_n " \"%s\" failed", 152 ngx_file_append_mode_n " \"%s\" failed",
153 file[i].name.data);
154 failed = 1;
155 break;
156 }
157 #else
158 if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {
159 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
160 "fcntl(FD_CLOEXEC) \"%s\" failed",
155 file[i].name.data); 161 file[i].name.data);
156 failed = 1; 162 failed = 1;
157 break; 163 break;
158 } 164 }
159 #endif 165 #endif
629 file[i].name.data); 635 file[i].name.data);
630 } 636 }
631 637
632 continue; 638 continue;
633 } 639 }
640 #else
641 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
642 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
643 "fcntl(FD_CLOEXEC) \"%s\" failed",
644 file[i].name.data);
645
646 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
647 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
648 ngx_close_file_n " \"%s\" failed",
649 file[i].name.data);
650 }
651
652 continue;
653 }
634 #endif 654 #endif
635 655
636 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { 656 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
637 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 657 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
638 ngx_close_file_n " \"%s\" failed", 658 ngx_close_file_n " \"%s\" failed",