summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-08-04 07:07:13 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-08-04 07:21:32 +0200
commitbcf982223cc5d051818dc88866a42f6a08f39a4a (patch)
tree86dc6209b34f71f2fcfa1b1bf49f5720c27f5fd1 /src
parentbase-filesystem: do not attempt to create a /lib64 -> /usr/lib/<tuple> symlink (diff)
downloadsystemd-bcf982223cc5d051818dc88866a42f6a08f39a4a.tar.xz
systemd-bcf982223cc5d051818dc88866a42f6a08f39a4a.zip
systemctl: refuse --capsule=foo with --system
Fixes the following assertion: === systemctl --capsule=hoge --system reboot Assertion 'runtime_scope == RUNTIME_SCOPE_USER' failed at src/shared/bus-util.c:479, function bus_connect_transport(). Aborting. Aborted (core dumped) === Follow-up for 56cb74c3cd1358d7d0b3f613feaf2eeab601a6bd.
Diffstat (limited to 'src')
-rw-r--r--src/systemctl/systemctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 5bb6ccacf7..1e36455cf2 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1075,6 +1075,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Cannot access user instance remotely.");
+ if (arg_transport == BUS_TRANSPORT_CAPSULE && arg_runtime_scope != RUNTIME_SCOPE_USER)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Cannot access system instance with --capsule=/-C.");
+
if (arg_wait && arg_no_block)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--wait may not be combined with --no-block.");