]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups/cgfsng: rework cgfsng_monitor_enter()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 17:13:54 +0000 (18:13 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 8 Dec 2019 01:35:52 +0000 (02:35 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index c2b9037095f4664f46b566c81109f9a8b97c25bc..374bbcf5ae9445f8b00c4a62732886f5a743afb6 100644 (file)
@@ -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",