mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-01 08:22:59 -05:00
Fixed data corruption when overwriting a file on a Fuse v3 filesystem
When a file of size "s" is overwritten, forcing "O_APPEND" flag makes the server file offset to be placed "s" bytes in advance. This caused subsequent write operations to be paded by "s" zeroes, thus corrupting the file.
This commit is contained in:
@ -1030,14 +1030,12 @@ static NTSTATUS fsp_fuse_intf_Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
* Some Windows applications (notably Go programs) specify FILE_APPEND_DATA without
|
||||
* FILE_WRITE_DATA when opening files for appending. This caused the WinFsp-FUSE layer
|
||||
* to erroneously pass O_RDONLY to the FUSE file system in such cases. We add a test
|
||||
* for FILE_APPEND_DATA to ensure that either O_WRONLY or O_RDWR is specified and that
|
||||
* the O_APPEND flag is set.
|
||||
* for FILE_APPEND_DATA to ensure that either O_WRONLY or O_RDWR is specified.
|
||||
*/
|
||||
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)
|
||||
|
Reference in New Issue
Block a user