File opened with O_TRUNC is not flushed - changed #291

This commit is contained in:
Takeshi Nakatani 2015-11-08 04:55:17 +00:00
parent 0fdda61fb5
commit c673d9d935

View File

@ -2026,8 +2026,10 @@ static int s3fs_open(const char* path, struct fuse_file_info* fi)
} }
if((unsigned int)fi->flags & O_TRUNC){ if((unsigned int)fi->flags & O_TRUNC){
st.st_size = 0; if(0 != st.st_size){
needs_flush = true; st.st_size = 0;
needs_flush = true;
}
} }
if(!S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)){ if(!S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)){
st.st_mtime = -1; st.st_mtime = -1;