mirror of
https://github.com/systemd/systemd.git
synced 2025-01-16 03:24:49 +03:00
systemctl: small cleanup
This commit is contained in:
parent
058fb31996
commit
05cae7f343
@ -5009,11 +5009,11 @@ static int enable_sysv_units(const char *verb, char **args) {
|
|||||||
r = 0;
|
r = 0;
|
||||||
for (f = 0; args[f]; f++) {
|
for (f = 0; args[f]; f++) {
|
||||||
const char *name;
|
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;
|
bool found_native = false, found_sysv;
|
||||||
unsigned c = 1;
|
unsigned c = 1;
|
||||||
const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
|
const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
|
||||||
char **k, *l;
|
char **k;
|
||||||
int j;
|
int j;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
siginfo_t status;
|
siginfo_t status;
|
||||||
@ -5027,6 +5027,8 @@ static int enable_sysv_units(const char *verb, char **args) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
STRV_FOREACH(k, paths.unit_path) {
|
STRV_FOREACH(k, paths.unit_path) {
|
||||||
|
_cleanup_free_ char *path = NULL;
|
||||||
|
|
||||||
if (!isempty(arg_root))
|
if (!isempty(arg_root))
|
||||||
asprintf(&p, "%s/%s/%s", arg_root, *k, name);
|
asprintf(&p, "%s/%s/%s", arg_root, *k, name);
|
||||||
else
|
else
|
||||||
@ -5038,9 +5040,6 @@ static int enable_sysv_units(const char *verb, char **args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
found_native = access(p, F_OK) >= 0;
|
found_native = access(p, F_OK) >= 0;
|
||||||
free(p);
|
|
||||||
p = NULL;
|
|
||||||
|
|
||||||
if (found_native)
|
if (found_native)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5057,9 +5056,8 @@ static int enable_sysv_units(const char *verb, char **args) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
p[strlen(p) - sizeof(".service") + 1] = 0;
|
p[strlen(p) - strlen(".service")] = 0;
|
||||||
found_sysv = access(p, F_OK) >= 0;
|
found_sysv = access(p, F_OK) >= 0;
|
||||||
|
|
||||||
if (!found_sysv)
|
if (!found_sysv)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -5084,7 +5082,6 @@ static int enable_sysv_units(const char *verb, char **args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_info("Executing %s", l);
|
log_info("Executing %s", l);
|
||||||
free(l);
|
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user