mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
nspawn: support pivot-root option during directory validation
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
This commit is contained in:
parent
2fcbdd2d3f
commit
c9fe05e07d
@ -4194,17 +4194,30 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (arg_start_mode == START_BOOT) {
|
||||
if (path_is_os_tree(arg_directory) <= 0) {
|
||||
log_error("Directory %s doesn't look like an OS root directory (os-release file is missing). Refusing.", arg_directory);
|
||||
const char *p;
|
||||
|
||||
if (arg_pivot_root_new)
|
||||
p = prefix_roota(arg_directory, arg_pivot_root_new);
|
||||
else
|
||||
p = arg_directory;
|
||||
|
||||
if (path_is_os_tree(p) <= 0) {
|
||||
log_error("Directory %s doesn't look like an OS root directory (os-release file is missing). Refusing.", p);
|
||||
r = -EINVAL;
|
||||
goto finish;
|
||||
}
|
||||
} else {
|
||||
const char *p;
|
||||
const char *p, *q;
|
||||
|
||||
p = strjoina(arg_directory, "/usr/");
|
||||
if (laccess(p, F_OK) < 0) {
|
||||
log_error("Directory %s doesn't look like it has an OS tree. Refusing.", arg_directory);
|
||||
if (arg_pivot_root_new)
|
||||
p = prefix_roota(arg_directory, arg_pivot_root_new);
|
||||
else
|
||||
p = arg_directory;
|
||||
|
||||
q = strjoina(p, "/usr/");
|
||||
|
||||
if (laccess(q, F_OK) < 0) {
|
||||
log_error("Directory %s doesn't look like it has an OS tree. Refusing.", p);
|
||||
r = -EINVAL;
|
||||
goto finish;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user