1
mirror of https://github.com/rclone/rclone synced 2025-01-01 01:06:24 +01:00

local: fix crash on Stat error while reading a file

This commit is contained in:
Nick Craig-Wood 2018-03-01 13:17:40 +00:00
parent f3e982d3bf
commit 7d4da1c66a

View File

@ -671,6 +671,9 @@ type localOpenFile struct {
func (file *localOpenFile) Read(p []byte) (n int, err error) {
// Check if file has the same size and modTime
fi, err := file.fd.Stat()
if err != nil {
return 0, errors.Wrap(err, "can't read status of source file while transferring")
}
if file.o.size != fi.Size() || file.o.modTime != fi.ModTime() {
return 0, errors.New("can't copy - source file is being updated")
}