]> git.kaiwu.me - nginx.git/commitdiff
Win32 appends synchronized if only FILE_APPEND_DATA and SYNCHRONIZE are set
authorIgor Sysoev <igor@sysoev.ru>
Tue, 31 Mar 2009 13:52:01 +0000 (13:52 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 31 Mar 2009 13:52:01 +0000 (13:52 +0000)
without any other flags. On the other hand, Unix requires at least the write
flag to be set together with O_APPEND.

src/core/ngx_cycle.c
src/core/ngx_log.c
src/core/ngx_open_file_cache.c
src/os/unix/ngx_files.h

index b6e9af2755af3a915b5ddb2bb61c7f4b2c89e761..d566f850cb98563b8e6f7065d14cdb57e1852e4c 100644 (file)
@@ -360,7 +360,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
         }
 
         file[i].fd = ngx_open_file(file[i].name.data,
-                                   NGX_FILE_RDWR|NGX_FILE_APPEND,
+                                   NGX_FILE_APPEND,
                                    NGX_FILE_CREATE_OR_OPEN,
                                    NGX_FILE_DEFAULT_ACCESS);
 
@@ -1065,7 +1065,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
             file[i].pos = file[i].buffer;
         }
 
-        fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR|NGX_FILE_APPEND,
+        fd = ngx_open_file(file[i].name.data, NGX_FILE_APPEND,
                            NGX_FILE_CREATE_OR_OPEN, NGX_FILE_DEFAULT_ACCESS);
 
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
index 83cbbee0d30835f19400a825607eba979c2ae766..f1718f18577a9beed2955e7fbb3f6403566f4ff7 100644 (file)
@@ -201,7 +201,7 @@ ngx_log_init(void)
     ngx_stderr_fileno = GetStdHandle(STD_ERROR_HANDLE);
 
     ngx_stderr.fd = ngx_open_file((u_char *) NGX_ERROR_LOG_PATH,
-                                  NGX_FILE_RDWR|NGX_FILE_APPEND,
+                                  NGX_FILE_APPEND,
                                   NGX_FILE_CREATE_OR_OPEN,
                                   NGX_FILE_DEFAULT_ACCESS);
 
index 2f6581bdac2a57ad1ab95ef99a77d28ddb72457d..cb707367517998f7090f3360f6f22edecdbeeb98 100644 (file)
@@ -466,8 +466,8 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log)
         fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
 
     } else {
-        fd = ngx_open_file(name, NGX_FILE_RDWR|NGX_FILE_APPEND,
-                           NGX_FILE_CREATE_OR_OPEN, NGX_FILE_DEFAULT_ACCESS);
+        fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
+                           NGX_FILE_DEFAULT_ACCESS);
     }
 
     if (fd == NGX_INVALID_FILE) {
index dcd14c35f248a112bdc43d981937c4f5212fc0f1..982ab12b3277604fab9d73681287fa41e895528e 100644 (file)
@@ -64,7 +64,7 @@ typedef struct {
 #define NGX_FILE_CREATE_OR_OPEN  O_CREAT
 #define NGX_FILE_OPEN            0
 #define NGX_FILE_TRUNCATE        O_TRUNC
-#define NGX_FILE_APPEND          O_APPEND
+#define NGX_FILE_APPEND          O_WRONLY|O_APPEND
 
 #define NGX_FILE_DEFAULT_ACCESS  0644
 #define NGX_FILE_OWNER_ACCESS    0600