mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
run: Don't make executable absolute when --root-directory= is used
Also, unless --same-root-dir was specified, don't make the executable absolute if we're running in a chroot. Situations like this are still iffy, but we might as well handle them a little more gracefully.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
ade882f16f
commit
2ba910ab06
@@ -65,6 +65,7 @@
|
||||
#include "unit-def.h"
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "virt.h"
|
||||
|
||||
static bool arg_ask_password = true;
|
||||
static bool arg_scope = false;
|
||||
@@ -3055,6 +3056,12 @@ static bool shall_make_executable_absolute(void) {
|
||||
return false;
|
||||
if (arg_transport != BUS_TRANSPORT_LOCAL)
|
||||
return false;
|
||||
if (!empty_or_root(arg_root_directory))
|
||||
return false;
|
||||
/* If we're running in a chroot, our view of the filesystem might be completely different from pid1's
|
||||
* view of the filesystem, hence don't try to resolve the executable in that case. */
|
||||
if (!arg_root_directory && running_in_chroot() > 0)
|
||||
return false;
|
||||
|
||||
FOREACH_STRING(f, "RootDirectory=", "RootImage=", "ExecSearchPath=", "MountImages=", "ExtensionImages=")
|
||||
if (strv_find_startswith(arg_property, f))
|
||||
|
||||
Reference in New Issue
Block a user