mirror of
https://github.com/rclone/rclone.git
synced 2025-02-18 11:31:19 +01:00
local: fix crash on Stat error while reading a file
This commit is contained in:
parent
f3e982d3bf
commit
7d4da1c66a
@ -671,6 +671,9 @@ type localOpenFile struct {
|
|||||||
func (file *localOpenFile) Read(p []byte) (n int, err error) {
|
func (file *localOpenFile) Read(p []byte) (n int, err error) {
|
||||||
// Check if file has the same size and modTime
|
// Check if file has the same size and modTime
|
||||||
fi, err := file.fd.Stat()
|
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() {
|
if file.o.size != fi.Size() || file.o.modTime != fi.ModTime() {
|
||||||
return 0, errors.New("can't copy - source file is being updated")
|
return 0, errors.New("can't copy - source file is being updated")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user