mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
systemctl-add-dependency: use CLEANUP_ARRAY
This commit is contained in:
parent
1b544e323e
commit
a372f9f16b
|
@ -16,6 +16,8 @@ int verb_add_dependency(int argc, char *argv[], void *userdata) {
|
|||
UnitDependency dep;
|
||||
int r;
|
||||
|
||||
CLEANUP_ARRAY(changes, n_changes, install_changes_free);
|
||||
|
||||
if (!argv[1])
|
||||
return 0;
|
||||
|
||||
|
@ -39,9 +41,8 @@ int verb_add_dependency(int argc, char *argv[], void *userdata) {
|
|||
if (install_client_side()) {
|
||||
r = unit_file_add_dependency(arg_runtime_scope, unit_file_flags_from_args(), arg_root, names, target, dep, &changes, &n_changes);
|
||||
install_changes_dump(r, "add dependency on", changes, n_changes, arg_quiet);
|
||||
|
||||
if (r > 0)
|
||||
r = 0;
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL, *m = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
|
@ -71,20 +72,15 @@ int verb_add_dependency(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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue