summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-06-15 03:04:06 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-12 13:30:53 +0200
commit455713ce7061afa6db68e72c93c061335dd941df (patch)
tree0253b3288b2bff00f91c934bedbe04de765f64e4
parent94f501805db8b272fd2d8d2c4eab0c5291db50e0 (diff)
downloadsystemd-455713ce7061afa6db68e72c93c061335dd941df.tar.gz
core/service: fix assertion when Type=dbus but BusName= is not specified
Fixes #19920. (cherry picked from commit 0f97b7c338bb7440572c454558efb8fee395896a)
-rw-r--r--src/core/service.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 751db053f3..e519c53a52 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -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);