summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-24 17:23:38 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-05-15 15:30:00 +0200
commit05cae7f3431446236139434ee58a6275f3cb31e8 (patch)
tree5de1951b1fc3079966b97064158c8cab8be87e37 /src/systemctl
parent058fb319964e739f3e5afa51ced3d1e25653a3f6 (diff)
systemctl: small cleanup
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index b13b2731ce..2fa8ecc664 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5009,11 +5009,11 @@ static int enable_sysv_units(const char *verb, char **args) {
r = 0;
for (f = 0; args[f]; f++) {
const char *name;
- _cleanup_free_ char *p = NULL, *q = NULL;
+ _cleanup_free_ char *p = NULL, *q = NULL, *l = NULL;
bool found_native = false, found_sysv;
unsigned c = 1;
const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
- char **k, *l;
+ char **k;
int j;
pid_t pid;
siginfo_t status;
@@ -5027,6 +5027,8 @@ static int enable_sysv_units(const char *verb, char **args) {
continue;
STRV_FOREACH(k, paths.unit_path) {
+ _cleanup_free_ char *path = NULL;
+
if (!isempty(arg_root))
asprintf(&p, "%s/%s/%s", arg_root, *k, name);
else
@@ -5038,9 +5040,6 @@ static int enable_sysv_units(const char *verb, char **args) {
}
found_native = access(p, F_OK) >= 0;
- free(p);
- p = NULL;
-
if (found_native)
break;
}
@@ -5057,9 +5056,8 @@ static int enable_sysv_units(const char *verb, char **args) {
goto finish;
}
- p[strlen(p) - sizeof(".service") + 1] = 0;
+ p[strlen(p) - strlen(".service")] = 0;
found_sysv = access(p, F_OK) >= 0;
-
if (!found_sysv)
continue;
@@ -5084,7 +5082,6 @@ static int enable_sysv_units(const char *verb, char **args) {
}
log_info("Executing %s", l);
- free(l);
pid = fork();
if (pid < 0) {