From 1d2045cb61ff1f0e66e3865527ad07c1c8725c55 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 13 Jul 2017 21:29:29 +0200 Subject: [PATCH] Test error for os.PathError See https://github.com/restic/restic/issues/1079#issuecomment-315177469 for details. --- src/restic/backend/local/local_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/restic/backend/local/local_unix.go b/src/restic/backend/local/local_unix.go index 83be4a5d4..684181c3f 100644 --- a/src/restic/backend/local/local_unix.go +++ b/src/restic/backend/local/local_unix.go @@ -12,7 +12,7 @@ import ( func setNewFileMode(f string, fi os.FileInfo) error { err := fs.Chmod(f, fi.Mode()&os.FileMode(^uint32(0222))) // ignore the error if the FS does not support setting this mode (e.g. CIFS with gvfs on Linux) - if err == syscall.ENOTSUP { + if perr, ok := err.(*os.PathError); ok && perr.Err == syscall.ENOTSUP { err = nil } return err