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: 382eba4354
Reported-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2023-03-27 09:53:32 -07:00
parent da5047c5d8
commit da98076c97
+1 -4
View File
@@ -469,6 +469,7 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
return err
}
}
return setRecAttr(m, rootfs)
case "cgroup":
if cgroups.IsCgroup2UnifiedMode() {
return mountCgroupV2(m, c)
@@ -483,10 +484,6 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
}
return mountPropagate(m, rootfs, mountLabel, mountFd)
}
if err := setRecAttr(m, rootfs); err != nil {
return err
}
return nil
}
func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {