mirror of
https://github.com/restic/restic.git
synced 2026-06-24 09:34:17 +00:00
Backup and restore setuid/setgid/sticky bits
A user discovered that restic does not restore setuid/setgid/sticky file attributes. This commit fixes that. The mode is stored in the Go format as an uint32: https://golang.org/pkg/os/#FileMode
This commit is contained in:
@@ -67,10 +67,11 @@ func (node Node) Tree() *Tree {
|
||||
|
||||
// NodeFromFileInfo returns a new node from the given path and FileInfo.
|
||||
func NodeFromFileInfo(path string, fi os.FileInfo) (*Node, error) {
|
||||
mask := os.ModePerm | os.ModeType | os.ModeSetuid | os.ModeSetgid | os.ModeSticky
|
||||
node := &Node{
|
||||
path: path,
|
||||
Name: fi.Name(),
|
||||
Mode: fi.Mode() & (os.ModePerm | os.ModeType),
|
||||
Mode: fi.Mode() & mask,
|
||||
ModTime: fi.ModTime(),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user