summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorMatteo Croce <teknoraver@meta.com>2024-07-09 01:24:50 +0200
committerMatteo Croce <teknoraver@meta.com>2024-07-16 15:03:37 +0200
commite51d8e0aa4b151fd54c0a3e345690522272499f2 (patch)
tree65265378b9896ed2f07eedb2b68970d4c6a9d6cd /src/shared
parentuse O_PATH to obtain cgroupfs fd (diff)
downloadsystemd-e51d8e0aa4b151fd54c0a3e345690522272499f2.tar.xz
systemd-e51d8e0aa4b151fd54c0a3e345690522272499f2.zip
use O_PATH to get the root fds
`switch_root()` opens two file descriptors to do the switch but never reads from them. Open them with O_PATH.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/switch-root.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index e64b6f6c8f..621161a1c0 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -58,7 +58,7 @@ int switch_root(const char *new_root,
if (old_root_fd < 0)
return log_error_errno(errno, "Failed to open root directory: %m");
- new_root_fd = open(new_root, O_DIRECTORY|O_CLOEXEC);
+ new_root_fd = open(new_root, O_PATH|O_DIRECTORY|O_CLOEXEC);
if (new_root_fd < 0)
return log_error_errno(errno, "Failed to open target directory '%s': %m", new_root);