diff --git a/session/filesync/filesync.go b/session/filesync/filesync.go index a51b490857f1..05e089340a9f 100644 --- a/session/filesync/filesync.go +++ b/session/filesync/filesync.go @@ -277,7 +277,7 @@ func (sp *fsSyncTarget) DiffCopy(stream FileSend_DiffCopyServer) (err error) { } defer func() { err1 := wc.Close() - if err != nil { + if err == nil { err = err1 } }()