From 1b22ee5b93fa16a7014402a1946eb63890017c98 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 18 Nov 2017 11:54:25 +0000 Subject: [PATCH] vfs: fix error handling in openPending so it returns the correct error --- vfs/read_write.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vfs/read_write.go b/vfs/read_write.go index b42d4f36e..fcaf65569 100644 --- a/vfs/read_write.go +++ b/vfs/read_write.go @@ -80,9 +80,9 @@ func (fh *RWFileHandle) openPending(truncate bool) (err error) { notFound := cause == fs.ErrorObjectNotFound || cause == fs.ErrorDirNotFound if notFound { // Remove cached item if there is one - err = os.Remove(fh.osPath) - if err != nil && !os.IsNotExist(err) { - return errors.Wrap(err, "open RW handle failed to delete stale cache file") + rmErr := os.Remove(fh.osPath) + if rmErr != nil && !os.IsNotExist(rmErr) { + return errors.Wrap(rmErr, "open RW handle failed to delete stale cache file") } } if notFound && fh.flags&os.O_CREATE != 0 {