Klaus Demo nginx / 9d4085a
merge r3498, r3499: opening files fixes: *) use non-blocking open() not to hang on FIFO files, etc. *) do not log misleading errno in "not a regular file" error Igor Sysoev 12 years ago
5 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
486486 }
487487
488488 if (!of->log) {
489 fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
489
490 /*
491 * Use non-blocking open() not to hang on FIFO files, etc.
492 * This flag has no effect on a regular files.
493 */
494
495 fd = ngx_open_file(name, NGX_FILE_RDONLY|NGX_FILE_NONBLOCK,
496 NGX_FILE_OPEN, 0);
490497
491498 } else {
492499 fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
178178 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */
179179
180180 if (!of.is_file) {
181 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
181 ngx_log_error(NGX_LOG_CRIT, log, 0,
182182 "\"%s\" is not a regular file", path.data);
183183
184184 return NGX_HTTP_NOT_FOUND;
187187 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */
188188
189189 if (!of.is_file) {
190 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
190 ngx_log_error(NGX_LOG_CRIT, log, 0,
191191 "\"%s\" is not a regular file", path.data);
192192
193193 return NGX_HTTP_NOT_FOUND;
6363 #define NGX_FILE_OPEN 0
6464 #define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC
6565 #define NGX_FILE_APPEND O_WRONLY|O_APPEND
66 #define NGX_FILE_NONBLOCK O_NONBLOCK
6667
6768 #define NGX_FILE_DEFAULT_ACCESS 0644
6869 #define NGX_FILE_OWNER_ACCESS 0600
6363 #define NGX_FILE_WRONLY GENERIC_WRITE
6464 #define NGX_FILE_RDWR GENERIC_READ|GENERIC_WRITE
6565 #define NGX_FILE_APPEND FILE_APPEND_DATA|SYNCHRONIZE
66 #define NGX_FILE_NONBLOCK 0
6667
6768 #define NGX_FILE_CREATE_OR_OPEN OPEN_ALWAYS
6869 #define NGX_FILE_OPEN OPEN_EXISTING