adopt NGX_FILE_TRUNCATE for win32

This commit is contained in:
Igor Sysoev 2009-04-08 19:03:41 +00:00
parent 64851bb2ae
commit 2ec2e35efe
3 changed files with 5 additions and 5 deletions

View File

@ -930,7 +930,7 @@ ngx_int_t
ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
{
size_t len;
ngx_uint_t trunc;
ngx_uint_t create;
ngx_file_t file;
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.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,
NGX_FILE_CREATE_OR_OPEN|trunc,
NGX_FILE_DEFAULT_ACCESS);
create, NGX_FILE_DEFAULT_ACCESS);
if (file.fd == NGX_INVALID_FILE) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,

View File

@ -63,7 +63,7 @@ typedef struct {
#define NGX_FILE_RDWR O_RDWR
#define NGX_FILE_CREATE_OR_OPEN O_CREAT
#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_DEFAULT_ACCESS 0644

View File

@ -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_OPEN OPEN_EXISTING
#define NGX_FILE_TRUNCATE CREATE_ALWAYS
#define NGX_FILE_DEFAULT_ACCESS 0
#define NGX_FILE_OWNER_ACCESS 0