]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: fix assertion when Type=dbus but BusName= is not specified
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Jun 2021 18:04:06 +0000 (03:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Jun 2021 18:06:09 +0000 (03:06 +0900)
Fixes #19920.

src/core/service.c

index 792ec99a00b80b995d90129fcf00e9d6e724c5eb..af5a2decf11347456a6087102976161ce0194b48 100644 (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);