]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: use correct scope of looking up units
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 Dec 2022 03:01:59 +0000 (12:01 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Dec 2022 11:45:33 +0000 (12:45 +0100)
Fixes a bug introduced by 3b3557c410c7910fae0990599dcb82711cf5fbb7.

Fixes #25625.

src/core/dbus-manager.c

index d2e73726065e3c0178820ed531e08b1a26b3571b..8d7b1f60daf0e2c7d41aedb8344258d5a5d0d2ac 100644 (file)
@@ -2629,11 +2629,10 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd
 
 static int method_get_unit_file_links(sd_bus_message *message, void *userdata, sd_bus_error *error) {
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
+        Manager *m = ASSERT_PTR(userdata);
         InstallChange *changes = NULL;
         size_t n_changes = 0, i;
-        UnitFileFlags flags;
         const char *name;
-        char **p;
         int runtime, r;
 
         r = sd_bus_message_read(message, "sb", &name, &runtime);
@@ -2648,11 +2647,9 @@ static int method_get_unit_file_links(sd_bus_message *message, void *userdata, s
         if (r < 0)
                 return r;
 
-        p = STRV_MAKE(name);
-        flags = UNIT_FILE_DRY_RUN |
-                (runtime ? UNIT_FILE_RUNTIME : 0);
-
-        r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, flags, NULL, p, &changes, &n_changes);
+        r = unit_file_disable(m->unit_file_scope,
+                              UNIT_FILE_DRY_RUN | (runtime ? UNIT_FILE_RUNTIME : 0),
+                              NULL, STRV_MAKE(name), &changes, &n_changes);
         if (r < 0) {
                 log_error_errno(r, "Failed to get file links for %s: %m", name);
                 goto finish;