projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b22befa
)
use O_PATH to get the root fds
author
Matteo Croce
<teknoraver@meta.com>
Mon, 8 Jul 2024 23:24:50 +0000
(
01:24
+0200)
committer
Matteo Croce
<teknoraver@meta.com>
Tue, 16 Jul 2024 13:03:37 +0000
(15:03 +0200)
`switch_root()` opens two file descriptors to do the switch but never
reads from them. Open them with O_PATH.
src/shared/switch-root.c
patch
|
blob
|
history
diff --git
a/src/shared/switch-root.c
b/src/shared/switch-root.c
index e64b6f6c8fc5219f3444e5abb35f0310bb794dba..621161a1c0f456053f7932d6d3e55ffab530af92 100644
(file)
--- 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);