rename mode to access

This commit is contained in:
Igor Sysoev 2007-01-18 19:52:18 +00:00
parent 6ed365fa8b
commit fe1cb8c3ac
6 changed files with 13 additions and 12 deletions

View File

@ -19,7 +19,7 @@ ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
if (tf->file.fd == NGX_INVALID_FILE) { if (tf->file.fd == NGX_INVALID_FILE) {
rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool, rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
tf->persistent, tf->mode); tf->persistent, tf->access);
if (rc == NGX_ERROR || rc == NGX_AGAIN) { if (rc == NGX_ERROR || rc == NGX_AGAIN) {
return rc; return rc;
@ -37,7 +37,7 @@ ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
ngx_int_t ngx_int_t
ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool, ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
ngx_uint_t persistent, ngx_uint_t mode) ngx_uint_t persistent, ngx_uint_t access)
{ {
ngx_err_t err; ngx_err_t err;
ngx_atomic_uint_t n; ngx_atomic_uint_t n;
@ -72,7 +72,7 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
return NGX_ERROR; return NGX_ERROR;
} }
file->fd = ngx_open_tempfile(file->name.data, persistent, mode); file->fd = ngx_open_tempfile(file->name.data, persistent, access);
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0, ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
"temp fd:%d", file->fd); "temp fd:%d", file->fd);

View File

@ -49,7 +49,7 @@ typedef struct {
ngx_pool_t *pool; ngx_pool_t *pool;
char *warn; char *warn;
ngx_uint_t mode; ngx_uint_t access;
unsigned log_level:8; unsigned log_level:8;
unsigned persistent:1; unsigned persistent:1;
@ -76,7 +76,7 @@ struct ngx_tree_ctx_s {
ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain); ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain);
ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
ngx_pool_t *pool, ngx_uint_t persistent,ngx_uint_t mode); ngx_pool_t *pool, ngx_uint_t persistent,ngx_uint_t access);
void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path); void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path);
ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path); ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path);
ngx_err_t ngx_create_full_path(u_char *dir, ngx_uint_t access); ngx_err_t ngx_create_full_path(u_char *dir, ngx_uint_t access);

View File

@ -74,13 +74,13 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
tf->persistent = r->request_body_in_persistent_file; tf->persistent = r->request_body_in_persistent_file;
if (r->request_body_file_group_access) { if (r->request_body_file_group_access) {
tf->mode = 0660; tf->access = 0660;
} }
rb->temp_file = tf; rb->temp_file = tf;
if (ngx_create_temp_file(&tf->file, tf->path, tf->pool, if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
tf->persistent, tf->mode) tf->persistent, tf->access)
!= NGX_OK) != NGX_OK)
{ {
return NGX_HTTP_INTERNAL_SERVER_ERROR; return NGX_HTTP_INTERNAL_SERVER_ERROR;
@ -400,7 +400,7 @@ ngx_http_write_request_body(ngx_http_request_t *r, ngx_chain_t *body)
tf->persistent = r->request_body_in_persistent_file; tf->persistent = r->request_body_in_persistent_file;
if (r->request_body_file_group_access) { if (r->request_body_file_group_access) {
tf->mode = 0660; tf->access = 0660;
} }
rb->temp_file = tf; rb->temp_file = tf;

View File

@ -112,11 +112,12 @@ ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
ngx_fd_t ngx_fd_t
ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t mode) ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t access)
{ {
ngx_fd_t fd; ngx_fd_t fd;
fd = open((const char *) name, O_CREAT|O_EXCL|O_RDWR, mode ? mode : 0600); fd = open((const char *) name, O_CREAT|O_EXCL|O_RDWR,
access ? access : 0600);
if (fd != -1 && !persistent) { if (fd != -1 && !persistent) {
unlink((const char *) name); unlink((const char *) name);

View File

@ -38,7 +38,7 @@
ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent,
ngx_uint_t mode); ngx_uint_t access);
#define ngx_open_tempfile_n "open()" #define ngx_open_tempfile_n "open()"

View File

@ -48,7 +48,7 @@ ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
#define ngx_file_append_mode_n "SetFilePointer()" #define ngx_file_append_mode_n "SetFilePointer()"
#define ngx_open_tempfile(name, persistent, mode) \ #define ngx_open_tempfile(name, persistent, access) \
CreateFile((const char *) name, \ CreateFile((const char *) name, \
GENERIC_READ|GENERIC_WRITE, \ GENERIC_READ|GENERIC_WRITE, \
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \