summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/systemctl/systemctl-preset-all.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/systemctl/systemctl-preset-all.c b/src/systemctl/systemctl-preset-all.c
index ed117e077c..6f221a87b9 100644
--- a/src/systemctl/systemctl-preset-all.c
+++ b/src/systemctl/systemctl-preset-all.c
@@ -12,6 +12,8 @@ int verb_preset_all(int argc, char *argv[], void *userdata) {
size_t n_changes = 0;
int r;
+ CLEANUP_ARRAY(changes, n_changes, install_changes_free);
+
if (install_client_side()) {
r = unit_file_preset_all(arg_runtime_scope, unit_file_flags_from_args(), arg_root, arg_preset_mode, &changes, &n_changes);
install_changes_dump(r, "preset", changes, n_changes, arg_quiet);
@@ -44,20 +46,15 @@ int verb_preset_all(int argc, char *argv[], void *userdata) {
r = bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
if (r < 0)
- goto finish;
+ return r;
- if (arg_no_reload) {
- r = 0;
- goto finish;
- }
+ if (arg_no_reload)
+ return 0;
r = daemon_reload(ACTION_RELOAD, /* graceful= */ false);
- if (r > 0)
- r = 0;
+ if (r < 0)
+ return r;
}
-finish:
- install_changes_free(changes, n_changes);
-
- return r;
+ return 0;
}