# HG changeset patch # User Igor Sysoev # Date 1271865576 0 # Node ID ac281bc4c187f5b984eaf170b10b9eb2d7783fe2 # Parent fb88801564dea6c10b9d017f6ebee27ed1196125 use non-blocking open() not to hang on FIFO files, etc. diff -r fb88801564de -r ac281bc4c187 src/core/ngx_open_file_cache.c --- a/src/core/ngx_open_file_cache.c Wed Apr 21 15:09:17 2010 +0000 +++ b/src/core/ngx_open_file_cache.c Wed Apr 21 15:59:36 2010 +0000 @@ -490,7 +490,14 @@ } if (!of->log) { - fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); + + /* + * Use non-blocking open() not to hang on FIFO files, etc. + * This flag has no effect on a regular files. + */ + + fd = ngx_open_file(name, NGX_FILE_RDONLY|NGX_FILE_NONBLOCK, + NGX_FILE_OPEN, 0); } else { fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN, diff -r fb88801564de -r ac281bc4c187 src/os/unix/ngx_files.h --- a/src/os/unix/ngx_files.h Wed Apr 21 15:09:17 2010 +0000 +++ b/src/os/unix/ngx_files.h Wed Apr 21 15:59:36 2010 +0000 @@ -64,6 +64,7 @@ #define NGX_FILE_OPEN 0 #define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC #define NGX_FILE_APPEND O_WRONLY|O_APPEND +#define NGX_FILE_NONBLOCK O_NONBLOCK #define NGX_FILE_DEFAULT_ACCESS 0644 #define NGX_FILE_OWNER_ACCESS 0600 diff -r fb88801564de -r ac281bc4c187 src/os/win32/ngx_files.h --- a/src/os/win32/ngx_files.h Wed Apr 21 15:09:17 2010 +0000 +++ b/src/os/win32/ngx_files.h Wed Apr 21 15:59:36 2010 +0000 @@ -64,6 +64,7 @@ #define NGX_FILE_WRONLY GENERIC_WRITE #define NGX_FILE_RDWR GENERIC_READ|GENERIC_WRITE #define NGX_FILE_APPEND FILE_APPEND_DATA|SYNCHRONIZE +#define NGX_FILE_NONBLOCK 0 #define NGX_FILE_CREATE_OR_OPEN OPEN_ALWAYS #define NGX_FILE_OPEN OPEN_EXISTING