From 396c327fe40b1db11fc204d7ae7ace84503de681 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 13 Feb 2023 18:16:02 +0100 Subject: Merging upstream version 1.38.1. Signed-off-by: Daniel Baumann --- collectors/cgroups.plugin/sys_fs_cgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'collectors/cgroups.plugin') diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 66db0b728..e63e042d0 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -589,7 +589,8 @@ void netdata_cgroup_ebpf_initialize_shm() PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd_cgroup_ebpf, 0); - if (!shm_cgroup_ebpf.header) { + if (unlikely(MAP_FAILED == shm_cgroup_ebpf.header)) { + shm_cgroup_ebpf.header = NULL; collector_error("Cannot map shared memory used between cgroup and eBPF, integration won't happen"); goto end_init_shm; } @@ -606,6 +607,7 @@ void netdata_cgroup_ebpf_initialize_shm() collector_error("Cannot create semaphore, integration between eBPF and cgroup won't happen"); munmap(shm_cgroup_ebpf.header, length); + shm_cgroup_ebpf.header = NULL; end_init_shm: close(shm_fd_cgroup_ebpf); -- cgit v1.2.3