2
2
mirror of https://github.com/octoleo/restic.git synced 2024-09-19 10:39:04 +00:00

local: Ignore ENOTSUP error for chmod

Closes: #1079
This commit is contained in:
Alexander Neumann 2017-07-03 19:44:56 +02:00
parent e7577d7bb4
commit a18c16e19e

View File

@ -5,9 +5,15 @@ package local
import (
"os"
"restic/fs"
"syscall"
)
// set file to readonly
func setNewFileMode(f string, fi os.FileInfo) error {
return fs.Chmod(f, fi.Mode()&os.FileMode(^uint32(0222)))
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 {
err = nil
}
return err
}