diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-17 15:44:59 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-23 14:49:37 +0200 |
commit | 8038b99d0d5be4ee5cfc5d99c3cf62f26223fb7a (patch) | |
tree | 2750f962fb733de9335f446099cb4f7dd7d4019c /src/run/run.c | |
parent | core: don't try to load units from non-absolute paths (diff) | |
download | systemd-8038b99d0d5be4ee5cfc5d99c3cf62f26223fb7a.tar.xz systemd-8038b99d0d5be4ee5cfc5d99c3cf62f26223fb7a.zip |
run: let systemd resolve the path with RootDirectory=/RootImage=
Fixes #13338.
Diffstat (limited to '')
-rw-r--r-- | src/run/run.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/run/run.c b/src/run/run.c index bdd82c085a..214b269569 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -1720,11 +1720,15 @@ static int run(int argc, char* argv[]) { if (r <= 0) return r; - if (!strv_isempty(arg_cmdline) && arg_transport == BUS_TRANSPORT_LOCAL) { - _cleanup_free_ char *command = NULL; - - /* Patch in an absolute path */ + if (!strv_isempty(arg_cmdline) && + arg_transport == BUS_TRANSPORT_LOCAL && + !strv_find_startswith(arg_property, "RootDirectory=") && + !strv_find_startswith(arg_property, "RootImage=")) { + /* Patch in an absolute path to fail early for user convenience, but only when we can do it + * (i.e. we will be running from the same file system). This also uses the user's $PATH, + * while we use a fixed search path in the manager. */ + _cleanup_free_ char *command = NULL; r = find_executable(arg_cmdline[0], &command); if (r < 0) return log_error_errno(r, "Failed to find executable %s: %m", arg_cmdline[0]); |