summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-05 01:56:47 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-05 01:56:47 +0100
commitaba843317d8acc4634417becebaedcfe5805d49d (patch)
tree932553c59cba02fe9fcd54bfd4b4b4a003203080 /src/systemctl
parent805d14864f8d6936202b85730a7d8a77317d1202 (diff)
systemctl: properly iterate through service array when dispatching to sysv
https://bugzilla.redhat.com/show_bug.cgi?id=1175734
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 9c4b9ed277..3d939f050b 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5188,8 +5188,10 @@ static int enable_sysv_units(const char *verb, char **args) {
return -EPROTO;
/* Remove this entry, so that we don't try enabling it as native unit */
- assert(f > 0 && streq(args[f-1], name));
- assert_se(strv_remove(args + f - 1, name));
+ assert(f > 0);
+ f--;
+ assert(args[f] == name);
+ strv_remove(args, name);
}
#endif