From c673d9d93539cb353fbbe671f41bc0302359b765 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 8 Nov 2015 04:55:17 +0000 Subject: [PATCH] File opened with O_TRUNC is not flushed - changed #291 --- src/s3fs.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 16c9025..62ba947 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -2026,8 +2026,10 @@ static int s3fs_open(const char* path, struct fuse_file_info* fi) } if((unsigned int)fi->flags & O_TRUNC){ - st.st_size = 0; - needs_flush = true; + if(0 != st.st_size){ + st.st_size = 0; + needs_flush = true; + } } if(!S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)){ st.st_mtime = -1;