From: Matteo Croce Date: Thu, 4 Jul 2024 01:16:29 +0000 (+0200) Subject: use O_PATH to obtain cgroupfs fd X-Git-Tag: v257-rc1~877^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b22befa9f56d8015690c877f35431f69b7ad5331;p=thirdparty%2Fsystemd.git use O_PATH to obtain cgroupfs fd We get a fd to cgroupfs just to avoid it being umounted, O_PATH is enough, use it instead of O_RDONLY. --- diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 9620436f687..6c131673461 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -4270,7 +4270,7 @@ int manager_setup_cgroup(Manager *m) { /* 6. And pin it, so that it cannot be unmounted */ safe_close(m->pin_cgroupfs_fd); - m->pin_cgroupfs_fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY|O_NONBLOCK); + m->pin_cgroupfs_fd = open(path, O_PATH|O_CLOEXEC|O_DIRECTORY); if (m->pin_cgroupfs_fd < 0) return log_error_errno(errno, "Failed to open pin file: %m");