mirror of
https://github.com/restic/restic.git
synced 2025-08-27 09:50:24 +00:00
Add option to use root as owner of files/dirs
This commit is contained in:
14
fuse/link.go
14
fuse/link.go
@@ -12,11 +12,12 @@ import (
|
||||
var _ = fs.NodeReadlinker(&link{})
|
||||
|
||||
type link struct {
|
||||
node *restic.Node
|
||||
node *restic.Node
|
||||
ownerIsRoot bool
|
||||
}
|
||||
|
||||
func newLink(repo *repository.Repository, node *restic.Node) (*link, error) {
|
||||
return &link{node: node}, nil
|
||||
func newLink(repo *repository.Repository, node *restic.Node, ownerIsRoot bool) (*link, error) {
|
||||
return &link{node: node, ownerIsRoot: ownerIsRoot}, nil
|
||||
}
|
||||
|
||||
func (l *link) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) {
|
||||
@@ -26,8 +27,11 @@ func (l *link) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string,
|
||||
func (l *link) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = l.node.Inode
|
||||
a.Mode = l.node.Mode
|
||||
a.Uid = l.node.UID
|
||||
a.Gid = l.node.GID
|
||||
|
||||
if !l.ownerIsRoot {
|
||||
a.Uid = l.node.UID
|
||||
a.Gid = l.node.GID
|
||||
}
|
||||
a.Atime = l.node.AccessTime
|
||||
a.Ctime = l.node.ChangeTime
|
||||
a.Mtime = l.node.ModTime
|
||||
|
Reference in New Issue
Block a user