mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
adopt NGX_FILE_TRUNCATE for win32
This commit is contained in:
parent
64851bb2ae
commit
2ec2e35efe
@ -930,7 +930,7 @@ ngx_int_t
|
|||||||
ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
|
ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
ngx_uint_t trunc;
|
ngx_uint_t create;
|
||||||
ngx_file_t file;
|
ngx_file_t file;
|
||||||
u_char pid[NGX_INT64_LEN + 2];
|
u_char pid[NGX_INT64_LEN + 2];
|
||||||
|
|
||||||
@ -939,11 +939,10 @@ ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
|
|||||||
file.name = *name;
|
file.name = *name;
|
||||||
file.log = log;
|
file.log = log;
|
||||||
|
|
||||||
trunc = ngx_test_config ? 0 : NGX_FILE_TRUNCATE;
|
create = ngx_test_config ? NGX_FILE_CREATE_OR_OPEN : NGX_FILE_TRUNCATE;
|
||||||
|
|
||||||
file.fd = ngx_open_file(file.name.data, NGX_FILE_RDWR,
|
file.fd = ngx_open_file(file.name.data, NGX_FILE_RDWR,
|
||||||
NGX_FILE_CREATE_OR_OPEN|trunc,
|
create, NGX_FILE_DEFAULT_ACCESS);
|
||||||
NGX_FILE_DEFAULT_ACCESS);
|
|
||||||
|
|
||||||
if (file.fd == NGX_INVALID_FILE) {
|
if (file.fd == NGX_INVALID_FILE) {
|
||||||
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
|
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
|
||||||
|
@ -63,7 +63,7 @@ typedef struct {
|
|||||||
#define NGX_FILE_RDWR O_RDWR
|
#define NGX_FILE_RDWR O_RDWR
|
||||||
#define NGX_FILE_CREATE_OR_OPEN O_CREAT
|
#define NGX_FILE_CREATE_OR_OPEN O_CREAT
|
||||||
#define NGX_FILE_OPEN 0
|
#define NGX_FILE_OPEN 0
|
||||||
#define NGX_FILE_TRUNCATE O_TRUNC
|
#define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC
|
||||||
#define NGX_FILE_APPEND O_WRONLY|O_APPEND
|
#define NGX_FILE_APPEND O_WRONLY|O_APPEND
|
||||||
|
|
||||||
#define NGX_FILE_DEFAULT_ACCESS 0644
|
#define NGX_FILE_DEFAULT_ACCESS 0644
|
||||||
|
@ -67,6 +67,7 @@ ngx_fd_t ngx_open_file(u_char *name, u_long mode, u_long create, u_long access);
|
|||||||
|
|
||||||
#define NGX_FILE_CREATE_OR_OPEN OPEN_ALWAYS
|
#define NGX_FILE_CREATE_OR_OPEN OPEN_ALWAYS
|
||||||
#define NGX_FILE_OPEN OPEN_EXISTING
|
#define NGX_FILE_OPEN OPEN_EXISTING
|
||||||
|
#define NGX_FILE_TRUNCATE CREATE_ALWAYS
|
||||||
|
|
||||||
#define NGX_FILE_DEFAULT_ACCESS 0
|
#define NGX_FILE_DEFAULT_ACCESS 0
|
||||||
#define NGX_FILE_OWNER_ACCESS 0
|
#define NGX_FILE_OWNER_ACCESS 0
|
||||||
|
Loading…
Reference in New Issue
Block a user