chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
networkd: store ifindex as int
[elogind.git]
/
src
/
systemctl
/
systemctl.c
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index fc325095ac833f16a89e95e33faa903f1eb72451..599d5907478408e4910880c738dd6f86b0e65b01 100644
(file)
--- a/
src/systemctl/systemctl.c
+++ b/
src/systemctl/systemctl.c
@@
-4998,15
+4998,9
@@
static int enable_sysv_units(const char *verb, char **args) {
STRV_FOREACH(k, paths.unit_path) {
_cleanup_free_ char *path = NULL;
STRV_FOREACH(k, paths.unit_path) {
_cleanup_free_ char *path = NULL;
- if (!isempty(arg_root))
- asprintf(&path, "%s/%s/%s", arg_root, *k, name);
- else
- asprintf(&path, "%s/%s", *k, name);
-
- if (!path) {
- r = log_oom();
- goto finish;
- }
+ path = path_join(arg_root, *k, name);
+ if (!path)
+ return log_oom();
found_native = access(path, F_OK) >= 0;
if (found_native)
found_native = access(path, F_OK) >= 0;
if (found_native)
@@
-5016,14
+5010,9
@@
static int enable_sysv_units(const char *verb, char **args) {
if (found_native)
continue;
if (found_native)
continue;
- if (!isempty(arg_root))
- asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
- else
- asprintf(&p, SYSTEM_SYSVINIT_PATH "/%s", name);
- if (!p) {
- r = log_oom();
- goto finish;
- }
+ p = path_join(arg_root, SYSTEM_SYSVINIT_PATH, name);
+ if (!p)
+ return log_oom();
p[strlen(p) - strlen(".service")] = 0;
found_sysv = access(p, F_OK) >= 0;
p[strlen(p) - strlen(".service")] = 0;
found_sysv = access(p, F_OK) >= 0;
@@
-5045,18
+5034,15
@@
static int enable_sysv_units(const char *verb, char **args) {
argv[c] = NULL;
l = strv_join((char**)argv, " ");
argv[c] = NULL;
l = strv_join((char**)argv, " ");
- if (!l) {
- r = log_oom();
- goto finish;
- }
+ if (!l)
+ return log_oom();
log_info("Executing %s", l);
pid = fork();
if (pid < 0) {
log_error("Failed to fork: %m");
log_info("Executing %s", l);
pid = fork();
if (pid < 0) {
log_error("Failed to fork: %m");
- r = -errno;
- goto finish;
+ return -errno;
} else if (pid == 0) {
/* Child */
} else if (pid == 0) {
/* Child */
@@
-5067,8
+5053,7
@@
static int enable_sysv_units(const char *verb, char **args) {
j = wait_for_terminate(pid, &status);
if (j < 0) {
log_error("Failed to wait for child: %s", strerror(-r));
j = wait_for_terminate(pid, &status);
if (j < 0) {
log_error("Failed to wait for child: %s", strerror(-r));
- r = j;
- goto finish;
+ return j;
}
if (status.si_code == CLD_EXITED) {
}
if (status.si_code == CLD_EXITED) {
@@
-5082,17
+5067,12
@@
static int enable_sysv_units(const char *verb, char **args) {
puts("disabled");
}
puts("disabled");
}
- } else if (status.si_status != 0) {
- r = -EINVAL;
- goto finish;
- }
- } else {
- r = -EPROTO;
- goto finish;
- }
+ } else if (status.si_status != 0)
+ return -EINVAL;
+ } else
+ return -EPROTO;
}
}
-finish:
/* Drop all SysV units */
for (f = 0, t = 0; args[f]; f++) {
/* Drop all SysV units */
for (f = 0, t = 0; args[f]; f++) {