core/service: fix assertion when Type=dbus but BusName= is not specified

Fixes #19920.
This commit is contained in:
Yu Watanabe
2021-06-15 03:06:09 +09:00
parent 1753d30215
commit 0f97b7c338
+2 -1
View File
@@ -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);