Mercurial > hg > nginx
changeset 2686:9e0ae986b587
adopt NGX_FILE_TRUNCATE for win32
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 08 Apr 2009 19:03:41 +0000 |
parents | 6c8a5165ed2a |
children | 5190c5dc3486 |
files | src/core/ngx_cycle.c src/os/unix/ngx_files.h src/os/win32/ngx_files.h |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_cycle.c Tue Apr 07 15:50:08 2009 +0000 +++ b/src/core/ngx_cycle.c Wed Apr 08 19:03:41 2009 +0000 @@ -930,7 +930,7 @@ 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 @@ 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,
--- a/src/os/unix/ngx_files.h Tue Apr 07 15:50:08 2009 +0000 +++ b/src/os/unix/ngx_files.h Wed Apr 08 19:03:41 2009 +0000 @@ -63,7 +63,7 @@ #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
--- a/src/os/win32/ngx_files.h Tue Apr 07 15:50:08 2009 +0000 +++ b/src/os/win32/ngx_files.h Wed Apr 08 19:03:41 2009 +0000 @@ -67,6 +67,7 @@ #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