jail: cgroup hack: rewrite cgroup -> cgroup2
authorDaniel Golle <daniel@makrotopia.org>
Wed, 28 Oct 2020 13:06:07 +0000 (13:06 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Sat, 21 Nov 2020 01:13:13 +0000 (01:13 +0000)
"I'm sure you said cgroup2"

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/fs.c

index 4cc273eea973386a7cea2091928295ab0d1c79af..d240daf7f44a75a076193ae719fa5d1dc655b12c 100644 (file)
--- a/jail/fs.c
+++ b/jail/fs.c
@@ -149,7 +149,8 @@ static int do_mount(const char *root, const char *orig_source, const char *targe
                mountflags |= MS_REMOUNT;
        }
 
-       if (mount(source?:(is_bind?new:NULL), new, filesystemtype, mountflags, optstr)) {
+       const char *hack_fstype = ((!filesystemtype || strcmp(filesystemtype, "cgroup"))?filesystemtype:"cgroup2");
+       if (mount(source?:(is_bind?new:NULL), new, hack_fstype, mountflags, optstr)) {
                if (error)
                        ERROR("failed to mount %s %s: %m\n", source, new);