mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 09:11:11 +08:00
vfs: Ignore Truncate if called with no readers and already the correct size
This fixes FreeBSD which seems to call SetAttr with a size even on read only files. This is probably a bug in the FreeBSD FUSE implementation as it happens with mount and cmount. See: https://forum.rclone.org/t/freebsd-question/8662/12
This commit is contained in:
parent
9310c7f3e2
commit
b5f563fb0f
|
@ -601,6 +601,12 @@ func (f *File) Truncate(size int64) (err error) {
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// If no writers, and size is already correct then all done
|
||||
if f.o.Size() == size {
|
||||
return nil
|
||||
}
|
||||
|
||||
fs.Debugf(f.o, "Truncating file")
|
||||
|
||||
// Otherwise if no writers then truncate the file by opening
|
||||
|
|
Loading…
Reference in New Issue
Block a user