mirror of
https://github.com/systemd/systemd
synced 2024-10-14 12:04:49 +00:00
Merge pull request #19921 from yuwata/service-verify-bus-type
core/service: fix assertion when Type=dbus but BusName= is not specified
This commit is contained in:
commit
e4948b0f0a
|
@ -668,7 +668,8 @@ static int service_setup_bus_name(Service *s) {
|
|||
|
||||
assert(s);
|
||||
|
||||
if (s->type != SERVICE_DBUS)
|
||||
/* If s->bus_name is not set, then the unit will be refused by service_verify() later. */
|
||||
if (s->type != SERVICE_DBUS || !s->bus_name)
|
||||
return 0;
|
||||
|
||||
r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, true, UNIT_DEPENDENCY_FILE);
|
||||
|
|
|
@ -65,6 +65,10 @@ test -f /run/dbus1
|
|||
systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus2' true
|
||||
test -f /run/dbus2
|
||||
|
||||
# https://github.com/systemd/systemd/issues/19920
|
||||
systemd-run --unit=dbus3.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p ExecStopPost='/bin/touch /run/dbus3' true \
|
||||
&& { echo 'unexpected success'; exit 1; }
|
||||
|
||||
cat >/tmp/notify1.sh <<EOF
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
|
Loading…
Reference in a new issue