2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Test error for os.PathError

See https://github.com/restic/restic/issues/1079#issuecomment-315177469
for details.
This commit is contained in:
Alexander Neumann 2017-07-13 21:29:29 +02:00
parent 357e2e404a
commit 1d2045cb61

View File

@ -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