changeset 2629:367b29612a00

Win32 appends synchronized if only FILE_APPEND_DATA and SYNCHRONIZE are set without any other flags. On the other hand, Unix requires at least the write flag to be set together with O_APPEND.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 31 Mar 2009 13:52:01 +0000
parents 64a10d6b97bd
children 73a132c47076
files src/core/ngx_cycle.c src/core/ngx_log.c src/core/ngx_open_file_cache.c src/os/unix/ngx_files.h
diffstat 4 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_cycle.c	Mon Mar 30 14:51:51 2009 +0000
+++ b/src/core/ngx_cycle.c	Tue Mar 31 13:52:01 2009 +0000
@@ -360,7 +360,7 @@
         }
 
         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 @@
             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,
--- a/src/core/ngx_log.c	Mon Mar 30 14:51:51 2009 +0000
+++ b/src/core/ngx_log.c	Tue Mar 31 13:52:01 2009 +0000
@@ -201,7 +201,7 @@
     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);
 
--- a/src/core/ngx_open_file_cache.c	Mon Mar 30 14:51:51 2009 +0000
+++ b/src/core/ngx_open_file_cache.c	Tue Mar 31 13:52:01 2009 +0000
@@ -466,8 +466,8 @@
         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) {
--- a/src/os/unix/ngx_files.h	Mon Mar 30 14:51:51 2009 +0000
+++ b/src/os/unix/ngx_files.h	Tue Mar 31 13:52:01 2009 +0000
@@ -64,7 +64,7 @@
 #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