diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c index f6e8671a38..4186ec3aea 100644 --- a/src/systemctl/systemctl-edit.c +++ b/src/systemctl/systemctl-edit.c @@ -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) &&