Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-01-18 23:15:09 +0300
committerIgor Sysoev <igor@sysoev.ru>2007-01-18 23:15:09 +0300
commit50034b856cd045b8d136f5bc2f3cd61a42d2a104 (patch)
treefabb58c6ac48b3606a2eb5c80391a9de833694dc
parent12fcfab8be58ec3d26cb405982a4dde5dab37d8d (diff)
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
-rw-r--r--src/core/ngx_conf_file.c2
-rw-r--r--src/core/ngx_cycle.c9
-rw-r--r--src/core/ngx_log.c2
-rw-r--r--src/http/modules/ngx_http_auth_basic_module.c2
-rw-r--r--src/http/modules/ngx_http_flv_module.c2
-rw-r--r--src/http/modules/ngx_http_index_module.c2
-rw-r--r--src/http/modules/ngx_http_static_module.c2
-rw-r--r--src/os/unix/ngx_files.h6
-rw-r--r--src/os/win32/ngx_files.h6
9 files changed, 20 insertions, 13 deletions
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index baa43c912..9e4b30a08 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -76,7 +76,7 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
/* 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 89109b389..7daebaac3 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -312,7 +312,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
}
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 @@ ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
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 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
}
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 280ead0db..73a305f59 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -209,7 +209,7 @@ ngx_log_init(void)
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 d021ef83e..19bfe996e 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 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r)
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 2b2b932c9..6fda6baf1 100644
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -109,7 +109,7 @@ ngx_http_flv_handler(ngx_http_request_t *r)
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 0f49551cc..d0f415fce 100644
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -245,7 +245,7 @@ ngx_http_index_handler(ngx_http_request_t *r)
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 bc150bffa..8f355dcf9 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -126,7 +126,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
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 1e98fc081..d89aee0ad 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 401b4df58..0815d3ea1 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()"