Skip to content

Commit 821d001

Browse files
committed
contrib/fs-idmap: Remove not needed flags
We don't really need to check if AT_RECURSIVE is possible here. We just want to check if we can idmap the src, it doesn't matter other nested mounts. While we are there, allow relative paths too. Signed-off-by: Rodrigo Campos <[email protected]>
1 parent 99340bb commit 821d001

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/cmd/fs-idmap/fs-idmap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func main() {
1616
}
1717

1818
src := os.Args[1]
19-
treeFD, err := unix.OpenTree(-1, src, uint(unix.OPEN_TREE_CLONE|unix.OPEN_TREE_CLOEXEC|unix.AT_EMPTY_PATH|unix.AT_RECURSIVE))
19+
treeFD, err := unix.OpenTree(unix.AT_FDCWD, src, uint(unix.OPEN_TREE_CLONE|unix.OPEN_TREE_CLOEXEC|unix.AT_EMPTY_PATH))
2020
if err != nil {
2121
log.Fatalf("error calling open_tree %q: %v", src, err)
2222
}
@@ -48,7 +48,7 @@ func main() {
4848
Attr_set: unix.MOUNT_ATTR_IDMAP,
4949
Userns_fd: uint64(userNsFile.Fd()),
5050
}
51-
if err := unix.MountSetattr(treeFD, "", unix.AT_EMPTY_PATH|unix.AT_RECURSIVE, &attr); err != nil {
51+
if err := unix.MountSetattr(treeFD, "", unix.AT_EMPTY_PATH, &attr); err != nil {
5252
log.Fatalf("error calling mount_setattr: %v", err)
5353
}
5454
}

0 commit comments

Comments
 (0)