]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #18244 from anitazha/systemctledit
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Jan 2021 10:07:02 +0000 (11:07 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Jan 2021 10:07:02 +0000 (11:07 +0100)
systemctl-edit fixes

src/systemctl/systemctl-edit.c

index f6e8671a388268d48e07a32b017243d5cde45a91..4186ec3aea76cd7822d2754c1a07c0d87344b9a5 100644 (file)
@@ -398,16 +398,14 @@ static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) {
                         /* If loading of the unit failed server side complete, then the server won't tell us
                          * the unit file path. In that case, find the file client side. */
                         log_debug_errno(r, "Unit '%s' was not loaded correctly, retrying client-side.", *name);
-                        r = unit_find_paths(bus, *name, &lp, true, &cached_name_map, &cached_id_map, &path, NULL);
+                        r = unit_find_paths(bus, *name, &lp, true, &cached_name_map, &cached_id_map, &path, &unit_paths);
                 }
                 if (r == -ERFKILL)
                         return log_error_errno(r, "Unit '%s' masked, cannot edit.", *name);
                 if (r < 0)
                         return r;
 
-                if (r == 0) {
-                        assert(!path);
-
+                if (!path) {
                         if (!arg_force) {
                                 log_info("Run 'systemctl edit%s --force --full %s' to create a new unit.",
                                          arg_scope == UNIT_FILE_GLOBAL ? " --global" :
@@ -422,8 +420,6 @@ static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) {
                                                  arg_full ? NULL : ".d/override.conf",
                                                  NULL, &new_path, &tmp_path);
                 } else {
-                        assert(path);
-
                         unit_name = basename(path);
                         /* We follow unit aliases, but we need to propagate the instance */
                         if (unit_name_is_valid(*name, UNIT_NAME_INSTANCE) &&