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. This adds an additional check for the
FILE_APPEND_DATA flag so that we can ensure the request is sent with at
least O_WRONLY and O_APPEND set.
This commit is contained in:
Brett Dutro 2019-10-21 15:36:07 -05:00
parent 3fe69f2208
commit b513128cfe
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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);