mirror of
https://github.com/octoleo/restic.git
synced 2024-11-02 11:46:36 +00:00
Merge pull request #1080 from restic/fix-1079
local: Ignore ENOTSUP error for chmod
This commit is contained in:
commit
357e2e404a
@ -5,9 +5,15 @@ package local
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"restic/fs"
|
"restic/fs"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// set file to readonly
|
// set file to readonly
|
||||||
func setNewFileMode(f string, fi os.FileInfo) error {
|
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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user