Skip to content

Commit da98076

Browse files
committed
mountToRootfs: minor refactor
The setRecAttr is only called for "bind" case, as cases end with a return statement. Indeed, recursive mount attributes only make sense for bind mounts. Move the code to under case "bind" to improve readability. No change in logic. Fixes: 382eba4 Reported-by: Sebastiaan van Stijn <[email protected]> Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent da5047c commit da98076

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

libcontainer/rootfs_linux.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
469469
return err
470470
}
471471
}
472+
return setRecAttr(m, rootfs)
472473
case "cgroup":
473474
if cgroups.IsCgroup2UnifiedMode() {
474475
return mountCgroupV2(m, c)
@@ -483,10 +484,6 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
483484
}
484485
return mountPropagate(m, rootfs, mountLabel, mountFd)
485486
}
486-
if err := setRecAttr(m, rootfs); err != nil {
487-
return err
488-
}
489-
return nil
490487
}
491488

492489
func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {

0 commit comments

Comments
 (0)