rcat: properly report if the upload fails

This commit is contained in:
Stefan Breunig 2017-09-13 20:21:52 +02:00
parent 2f0551074c
commit 56dedc49e3

View File

@ -1584,10 +1584,11 @@ func Cat(f Fs, w io.Writer, offset, count int64) error {
// Rcat reads data from the Reader until EOF and uploads it to a file on remote
func Rcat(fdst Fs, dstFileName string, in0 io.ReadCloser, modTime time.Time) (err error) {
Stats.Transferring(dstFileName)
defer func() {
Stats.DoneTransferring(dstFileName, err == nil)
if err = in0.Close(); err != nil {
if otherErr := in0.Close(); otherErr != nil {
Debugf(fdst, "Rcat: failed to close source: %v", err)
}
}()