mirror of
https://github.com/restic/restic.git
synced 2025-07-28 15:13:36 +00:00
Merge pull request #5345 from mikix/chmod-enotsup
backend/local: ignore chmod "not supported" errors
This commit is contained in:
commit
b71fe91643
7
changelog/unreleased/issue-5342
Normal file
7
changelog/unreleased/issue-5342
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Bugfix: Ignore "chmod not supported" errors when writing files
|
||||||
|
|
||||||
|
Restic 0.18.0 introduced a bug that caused "chmod xxx: operation not supported"
|
||||||
|
errors to appear when writing to a local file repository that did not support
|
||||||
|
chmod (like CIFS or WebDAV mounted via FUSE). Restic now ignores those errors.
|
||||||
|
|
||||||
|
https://github.com/restic/restic/issues/5342
|
@ -43,5 +43,12 @@ func isMacENOTTY(err error) bool {
|
|||||||
|
|
||||||
// set file to readonly
|
// set file to readonly
|
||||||
func setFileReadonly(f string, mode os.FileMode) error {
|
func setFileReadonly(f string, mode os.FileMode) error {
|
||||||
return os.Chmod(f, mode&^0222)
|
err := os.Chmod(f, mode&^0222)
|
||||||
|
|
||||||
|
// ignore the error if the FS does not support setting this mode (e.g. CIFS with gvfs on Linux)
|
||||||
|
if err != nil && errors.Is(err, errors.ErrUnsupported) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user