ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index baa43c9..9e4b30a 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c
@@ -76,7 +76,7 @@ /* open configuration file */ - fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN); + fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); if (fd == NGX_INVALID_FILE) { ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, ngx_open_file_n " \"%s\" failed",
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index 89109b3..7daebaa 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c
@@ -312,7 +312,8 @@ } file[i].fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR, - NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND); + NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, + NGX_FILE_DEFAULT_ACCESS); ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0, "log: %p %d \"%s\"", @@ -849,7 +850,8 @@ trunc = ngx_test_config ? 0 : NGX_FILE_TRUNCATE; file.fd = ngx_open_file(file.name.data, NGX_FILE_RDWR, - NGX_FILE_CREATE_OR_OPEN|trunc); + NGX_FILE_CREATE_OR_OPEN|trunc, + NGX_FILE_DEFAULT_ACCESS); if (file.fd == NGX_INVALID_FILE) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, @@ -959,7 +961,8 @@ } fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR, - NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND); + NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, + NGX_FILE_DEFAULT_ACCESS); ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "reopen file \"%s\", old:%d new:%d",
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c index 280ead0..73a305f 100644 --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c
@@ -209,7 +209,7 @@ ngx_stderr_fileno = GetStdHandle(STD_ERROR_HANDLE); ngx_stderr.fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR, - NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND); + NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, 0); if (ngx_stderr.fd == NGX_INVALID_FILE) { ngx_message_box("nginx", MB_OK, ngx_errno,
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c index d021ef8..19bfe99 100644 --- a/src/http/modules/ngx_http_auth_basic_module.c +++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -133,7 +133,7 @@ return NGX_HTTP_INTERNAL_SERVER_ERROR; } - fd = ngx_open_file(alcf->user_file.data, NGX_FILE_RDONLY, NGX_FILE_OPEN); + fd = ngx_open_file(alcf->user_file.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); if (fd == NGX_INVALID_FILE) { ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c index 2b2b932..6fda6ba 100644 --- a/src/http/modules/ngx_http_flv_module.c +++ b/src/http/modules/ngx_http_flv_module.c
@@ -109,7 +109,7 @@ return NGX_HTTP_INTERNAL_SERVER_ERROR; } - fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN); + fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); if (fd == NGX_INVALID_FILE) { err = ngx_errno;
diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c index 0f49551..d0f415f 100644 --- a/src/http/modules/ngx_http_index_module.c +++ b/src/http/modules/ngx_http_index_module.c
@@ -245,7 +245,7 @@ return NGX_HTTP_INTERNAL_SERVER_ERROR; } - fd = ngx_open_file(ctx->path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN); + fd = ngx_open_file(ctx->path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); if (fd == (ngx_fd_t) NGX_AGAIN) { ctx->current = i;
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c index bc150bf..8f355dc 100644 --- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c
@@ -126,7 +126,7 @@ return NGX_HTTP_INTERNAL_SERVER_ERROR; } - fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN); + fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); if (fd == NGX_INVALID_FILE) { err = ngx_errno;
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index 1e98fc0..d89aee0 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h
@@ -17,8 +17,8 @@ -#define ngx_open_file(name, access, create) \ - open((const char *) name, access|create, 0644) +#define ngx_open_file(name, mode, create, access) \ + open((const char *) name, mode|create, access) #define ngx_open_file_n "open()" #define NGX_FILE_RDONLY O_RDONLY @@ -28,6 +28,8 @@ #define NGX_FILE_TRUNCATE O_TRUNC #define NGX_FILE_APPEND O_APPEND +#define NGX_FILE_DEFAULT_ACCESS 0644 + #define ngx_close_file close #define ngx_close_file_n "close()"
diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h index 401b4df..0815d3e 100644 --- a/src/os/win32/ngx_files.h +++ b/src/os/win32/ngx_files.h
@@ -28,8 +28,8 @@ -#define ngx_open_file(name, access, create) \ - CreateFile((const char *) name, access, \ +#define ngx_open_file(name, mode, create, access) \ + CreateFile((const char *) name, mode, \ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \ NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL) /* @@ -43,6 +43,8 @@ #define NGX_FILE_OPEN OPEN_EXISTING #define NGX_FILE_APPEND 0 +#define NGX_FILE_DEFAULT_ACCESS 0 + ngx_int_t ngx_file_append_mode(ngx_fd_t fd); #define ngx_file_append_mode_n "SetFilePointer()"