lib: ignore invalid mounts in cg_init_map

In case of bad entries in /proc/mounts just skip cgroup cache initialization.
Cgroups in output will be shown as "unreachable:cgroup_id".

Fixes: d5e6ee0dac ("ss: introduce cgroup2 cache and helper functions")
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Reported-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Dmitry Yakunin 2020-10-08 20:59:27 +03:00 committed by Stephen Hemminger
parent 003b9af516
commit 58c3c55f38
1 changed files with 2 additions and 3 deletions

View File

@ -96,11 +96,10 @@ static void cg_init_map(void)
mnt = find_cgroup2_mount(false);
if (!mnt)
exit(1);
return;
mntlen = strlen(mnt);
if (nftw(mnt, nftw_fn, 1024, FTW_MOUNT) < 0)
exit(1);
(void) nftw(mnt, nftw_fn, 1024, FTW_MOUNT);
free(mnt);
}