1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

systemctl: don't assert on the arguments array unnecessarily

In most verbs it's fine to treat the arguments array being NULL is empty
array, hence do so.
This commit is contained in:
Lennart Poettering 2015-09-29 13:38:36 +02:00
parent 14b316ebf8
commit 4057e12315

View File

@ -2175,8 +2175,6 @@ static int cancel_job(char **args) {
char **name; char **name;
int r = 0; int r = 0;
assert(args);
if (strv_length(args) <= 1) if (strv_length(args) <= 1)
return daemon_reload(args); return daemon_reload(args);
@ -3154,8 +3152,6 @@ static int check_unit_generic(int code, const char *good_states, char **args) {
char **name; char **name;
int r; int r;
assert(args);
r = acquire_bus(BUS_MANAGER, &bus); r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0) if (r < 0)
return r; return r;
@ -3192,8 +3188,6 @@ static int kill_unit(char **args) {
sd_bus *bus; sd_bus *bus;
int r, q; int r, q;
assert(args);
polkit_agent_open_if_enabled(); polkit_agent_open_if_enabled();
r = acquire_bus(BUS_MANAGER, &bus); r = acquire_bus(BUS_MANAGER, &bus);
@ -4764,8 +4758,6 @@ static int cat(char **args) {
bool first = true; bool first = true;
int r; int r;
assert(args);
if (arg_transport != BUS_TRANSPORT_LOCAL) { if (arg_transport != BUS_TRANSPORT_LOCAL) {
log_error("Cannot remotely cat units."); log_error("Cannot remotely cat units.");
return -EINVAL; return -EINVAL;
@ -4941,8 +4933,6 @@ static int delete_snapshot(char **args) {
char **name; char **name;
int r; int r;
assert(args);
polkit_agent_open_if_enabled(); polkit_agent_open_if_enabled();
r = acquire_bus(BUS_MANAGER, &bus); r = acquire_bus(BUS_MANAGER, &bus);
@ -5228,8 +5218,6 @@ static int import_environment(char **args) {
sd_bus *bus; sd_bus *bus;
int r; int r;
assert(args);
polkit_agent_open_if_enabled(); polkit_agent_open_if_enabled();
r = acquire_bus(BUS_MANAGER, &bus); r = acquire_bus(BUS_MANAGER, &bus);
@ -6198,8 +6186,6 @@ static int edit(char **args) {
sd_bus *bus; sd_bus *bus;
int r; int r;
assert(args);
if (!on_tty()) { if (!on_tty()) {
log_error("Cannot edit units if not on a tty."); log_error("Cannot edit units if not on a tty.");
return -EINVAL; return -EINVAL;