]> git.ipfire.org Git - thirdparty/lxc.git/commit
cgfs: explicitly check for NULL
authorChristian Brauner <christian.brauner@canonical.com>
Sun, 30 Oct 2016 13:44:33 +0000 (14:44 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 18 Nov 2016 01:38:32 +0000 (20:38 -0500)
commit648f2ac613daa83bed6345fb7cd611199585025f
tree72686ed990e3ad7d31146737401535f3d910c3c9
parent20aa5993a60582fea85f471abcd64bd9ccb78990
cgfs: explicitly check for NULL

Somehow this implementation of a cgroupfs backend decided to use the hierarchy
numbers it detects in /proc/cgroups and /proc/self/cgroups as indices for
the hierarchy struct. Controller numbering usually starts at 1 but may start at
0 if:

    a) the controller is not mounted on a cgroups v1 hierarchy;
    b) the controller is bound to the cgroups v2 single unified hierarchy; or
    c) the controller is disabled

To avoid having to rework our fallback backend significantly, we should
explicitly check for each controller if hierarchy[i] != NULL.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/cgfs.c