diff --git a/Contributors.asciidoc b/Contributors.asciidoc index 363c4c92..a82fa503 100644 --- a/Contributors.asciidoc +++ b/Contributors.asciidoc @@ -56,6 +56,7 @@ CONTRIBUTOR LIST |=== |Ben Rubson |ben.rubson at gmail.com |Bill Zissimopoulos |billziss at navimatics.com +|Brett Dutro |brett.dutro at gmail.com |Colin Atkinson (Atakama, https://atakama.com) |colin at atakama.com |Felix Croes |felix at dworkin.nl |Francois Karam (KS2, http://www.ks2.fr) |francois.karam at ks2.fr diff --git a/src/dll/fuse/fuse_intf.c b/src/dll/fuse/fuse_intf.c index dd1d975f..9ebc4de7 100644 --- a/src/dll/fuse/fuse_intf.c +++ b/src/dll/fuse/fuse_intf.c @@ -1026,6 +1026,22 @@ static NTSTATUS fsp_fuse_intf_Open(FSP_FILE_SYSTEM *FileSystem, } else { + /* + * In Windows, Go clears any write-related flags when O_APPEND is specified. + * This causes WinFSP to think that any O_APPEND requests are actually read-only. + * Adding an additional check for the FILE_APPEND_DATA flag ensures the request + * is sent with at least O_WRONLY and O_APPEND set. + */ + if (GrantedAccess & FILE_APPEND_DATA) + { + if (fi.flags == 0) + { + fi.flags = 1; // Need O_WRONLY as a bare minimum in order to append + } + + fi.flags |= 8; /*O_APPEND*/ + } + if (0 != f->ops.open) { err = f->ops.open(contexthdr->PosixPath, &fi);