From b22befa9f56d8015690c877f35431f69b7ad5331 Mon Sep 17 00:00:00 2001 From: Matteo Croce Date: Thu, 4 Jul 2024 03:16:29 +0200 Subject: [PATCH] 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. --- src/core/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 9620436f68..6c13167346 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");