Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: fix truncation work-around on Windows

Nick Craig-Woodc3d0f68923ce
diff --git a/vfs/read_write.go b/vfs/read_write.go
index 69913ae3d..9918cd3d0 100644
--- a/vfs/read_write.go
+++ b/vfs/read_write.go
@@ -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 {