]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
process-util: check the flag instead of 'cgroup' param
authorMike Yuan <me@yhndnzj.com>
Tue, 20 Aug 2024 20:01:09 +0000 (22:01 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 21 Aug 2024 13:17:05 +0000 (15:17 +0200)
We might skip CLONE_INTO_CGROUP wholly if not supported.

src/basic/process-util.c

index a247b5a0b25246684fff76ca0b2b87170af931e7..711457fa7b70dff1ea504782f9597cc9c80bb2ed 100644 (file)
@@ -2118,7 +2118,7 @@ int posix_spawn_wrapper(
         }
         if (ERRNO_IS_NOT_SUPPORTED(r)) {
                 /* clone3() could also return EOPNOTSUPP if the target cgroup is in threaded mode. */
-                if (cgroup && cg_is_threaded(cgroup) > 0)
+                if (FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP) && cg_is_threaded(cgroup) > 0)
                         return -EUCLEAN;
 
                 /* clone3() not available? */