aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index fca2f703d..ee13ae8ad 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -552,7 +552,10 @@ static int robust_open(const char *z, int f, mode_t m){
if( fd>=0 ){
if( m!=0 ){
struct stat statbuf;
- if( osFstat(fd, &statbuf)==0 && (statbuf.st_mode&0777)!=m ){
+ if( osFstat(fd, &statbuf)==0
+ && statbuf.st_size==0
+ && statbuf.st_mode&0777!=m
+ ){
osFchmod(fd, m);
}
}