From: Christian Brauner Date: Sat, 7 Dec 2019 23:13:14 +0000 (+0100) Subject: cgroups/cgfsng: rework cgfsng_payload_enter() X-Git-Tag: lxc-4.0.0~78^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4490328e59901bf16290279445d8eea1f8fce454;p=thirdparty%2Flxc.git cgroups/cgfsng: rework cgfsng_payload_enter() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index d1a18174c..1638f5d52 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1491,9 +1491,18 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops, int len; char pidstr[INTTYPE_TO_STRLEN(pid_t)]; + if (!ops) + return ret_set_errno(false, ENOENT); + if (!ops->hierarchies) return true; + if (!ops->container_cgroup) + return ret_set_errno(false, ENOENT); + + if (!handler || !handler->conf) + return ret_set_errno(false, EINVAL); + len = snprintf(pidstr, sizeof(pidstr), "%d", handler->pid); for (int i = 0; ops->hierarchies[i]; i++) {