mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
vfs: fix truncation work-around on Windows
This no longer needs to deal with O_RDONLY and O_TRUNC since we disallow this earlier. This also fixes the code to just do it for O_APPEND, not for everything.
This commit is contained in:
parent
f57e92b9a5
commit
c3d0f68923
@ -170,7 +170,7 @@ func (fh *RWFileHandle) openPending(truncate bool) (err error) {
|
||||
// Windows doesn't seem to deal well with O_TRUNC and
|
||||
// certain access modes so so truncate the file if it
|
||||
// exists in these cases.
|
||||
if runtime.GOOS == "windows" && (fh.flags&accessModeMask == os.O_RDONLY || fh.flags|os.O_APPEND != 0) {
|
||||
if runtime.GOOS == "windows" && fh.flags&os.O_APPEND != 0 {
|
||||
cacheFileOpenFlags &^= os.O_TRUNC
|
||||
_, err = os.Stat(fh.osPath)
|
||||
if err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user