use O_PATH when getting cgroup fd

O_PATH mode is enough to attach a bpf program to a cgroup, use it
instead of O_RDONLY
This commit is contained in:
Matteo Croce
2024-07-04 03:14:22 +02:00
parent b209fff3a5
commit 572e163ef5

View File

@@ -128,7 +128,7 @@ static int restrict_ifaces_install_impl(Unit *u) {
if (r < 0)
return r;
cgroup_fd = open(cgroup_path, O_RDONLY | O_CLOEXEC | O_DIRECTORY, 0);
cgroup_fd = open(cgroup_path, O_PATH | O_CLOEXEC | O_DIRECTORY, 0);
if (cgroup_fd < 0)
return -errno;