libct: use Namespaces.IsPrivate more

In these cases, this is exactly what we want to find out.

Slightly improves performance and readability.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2024-09-09 18:25:28 -07:00
parent 15904913c2
commit b1449fd510
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ func rootlessEUIDMappings(config *configs.Config) error {
return errors.New("rootless container requires user namespaces")
}
// We only require mappings if we are not joining another userns.
if path := config.Namespaces.PathOf(configs.NEWUSER); path == "" {
if config.Namespaces.IsPrivate(configs.NEWUSER) {
if len(config.UIDMappings) == 0 {
return errors.New("rootless containers requires at least one UID mapping")
}