]> 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>
Sat, 7 Dec 2019 23:13:37 +0000 (00:13 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index aa90842ffa3ce9faebb527148724b346980c48f4..abd085a6d374cdb706cc4d6b0a4d08e65b5635f7 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",