From: Christian Brauner Date: Sat, 7 Dec 2019 17:13:54 +0000 (+0100) Subject: cgroups/cgfsng: rework cgfsng_monitor_enter() X-Git-Tag: lxc-4.0.0~78^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=797fa65e6ddb6b015deb59c8f40232d241ecc9f8;p=thirdparty%2Flxc.git cgroups/cgfsng: rework cgfsng_monitor_enter() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index aa90842ff..abd085a6d 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1445,9 +1445,18 @@ __cgfsng_ops static bool cgfsng_monitor_enter(struct cgroup_ops *ops, char monitor[INTTYPE_TO_STRLEN(pid_t)], transient[INTTYPE_TO_STRLEN(pid_t)]; + if (!ops) + return ret_set_errno(false, ENOENT); + if (!ops->hierarchies) return true; + if (!ops->monitor_cgroup) + return ret_set_errno(false, ENOENT); + + if (!handler || !handler->conf) + return ret_set_errno(false, EINVAL); + monitor_len = snprintf(monitor, sizeof(monitor), "%d", handler->monitor_pid); if (handler->transient_pid > 0) transient_len = snprintf(transient, sizeof(transient), "%d",