]> git.ipfire.org Git - thirdparty/lxc.git/commit
cgfs: explicitly check for NULL 1262/head
authorChristian Brauner <christian.brauner@canonical.com>
Sun, 30 Oct 2016 13:44:33 +0000 (14:44 +0100)
committerChristian Brauner <christian.brauner@canonical.com>
Sun, 30 Oct 2016 14:16:52 +0000 (15:16 +0100)
commit517587ef58a7dfd0bbc597963fd9a99ab4099420
tree4bc3e668243b5fa00f170389f2a6afe3f6952209
parent82a2fe03a61febcc1b2300550a70ac698cb1fd11
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/cgroups/cgfs.c