chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: drop usage of "internally loaded modules"
[elogind.git]
/
src
/
systemctl
/
systemctl.c
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index 2f43052f9af029187bcc7c0996008147bca653e4..13b6ab02015dfcadd0b8aa7b5b23992dbf94e77b 100644
(file)
--- a/
src/systemctl/systemctl.c
+++ b/
src/systemctl/systemctl.c
@@
-4009,11
+4009,11
@@
static int enable_sysv_units(char **args) {
r = 0;
for (f = 1; args[f]; f++) {
const char *name;
r = 0;
for (f = 1; args[f]; f++) {
const char *name;
- char
*p
;
+ char
_cleanup_free_ *p = NULL, *q = NULL
;
bool found_native = false, found_sysv;
unsigned c = 1;
const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
bool found_native = false, found_sysv;
unsigned c = 1;
const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
- char **k, *l
, *q = NULL
;
+ char **k, *l;
int j;
pid_t pid;
siginfo_t status;
int j;
pid_t pid;
siginfo_t status;
@@
-4027,8
+4027,6
@@
static int enable_sysv_units(char **args) {
continue;
STRV_FOREACH(k, paths.unit_path) {
continue;
STRV_FOREACH(k, paths.unit_path) {
- p = NULL;
-
if (!isempty(arg_root))
asprintf(&p, "%s/%s/%s", arg_root, *k, name);
else
if (!isempty(arg_root))
asprintf(&p, "%s/%s/%s", arg_root, *k, name);
else
@@
-4041,6
+4039,7
@@
static int enable_sysv_units(char **args) {
found_native = access(p, F_OK) >= 0;
free(p);
found_native = access(p, F_OK) >= 0;
free(p);
+ p = NULL;
if (found_native)
break;
if (found_native)
break;
@@
-4049,7
+4048,6
@@
static int enable_sysv_units(char **args) {
if (found_native)
continue;
if (found_native)
continue;
- p = NULL;
if (!isempty(arg_root))
asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
else
if (!isempty(arg_root))
asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
else
@@
-4062,10
+4060,8
@@
static int enable_sysv_units(char **args) {
p[strlen(p) - sizeof(".service") + 1] = 0;
found_sysv = access(p, F_OK) >= 0;
p[strlen(p) - sizeof(".service") + 1] = 0;
found_sysv = access(p, F_OK) >= 0;
- if (!found_sysv) {
- free(p);
+ if (!found_sysv)
continue;
continue;
- }
/* Mark this entry, so that we don't try enabling it as native unit */
args[f] = (char*) "";
/* Mark this entry, so that we don't try enabling it as native unit */
args[f] = (char*) "";
@@
-4083,8
+4079,6
@@
static int enable_sysv_units(char **args) {
l = strv_join((char**)argv, " ");
if (!l) {
l = strv_join((char**)argv, " ");
if (!l) {
- free(q);
- free(p);
r = log_oom();
goto finish;
}
r = log_oom();
goto finish;
}
@@
-4095,8
+4089,6
@@
static int enable_sysv_units(char **args) {
pid = fork();
if (pid < 0) {
log_error("Failed to fork: %m");
pid = fork();
if (pid < 0) {
log_error("Failed to fork: %m");
- free(p);
- free(q);
r = -errno;
goto finish;
} else if (pid == 0) {
r = -errno;
goto finish;
} else if (pid == 0) {
@@
-4106,9
+4098,6
@@
static int enable_sysv_units(char **args) {
_exit(EXIT_FAILURE);
}
_exit(EXIT_FAILURE);
}
- free(p);
- free(q);
-
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));
@@
-4488,7
+4477,9
@@
static int systemctl_help(void) {
" --version Show package version\n"
" -t --type=TYPE List only units of a particular type\n"
" -p --property=NAME Show only properties by this name\n"
" --version Show package version\n"
" -t --type=TYPE List only units of a particular type\n"
" -p --property=NAME Show only properties by this name\n"
- " -a --all Show all units/properties, including dead/empty ones\n"
+ " -a --all Show all loaded units/properties, including dead/empty\n"
+ " ones. To list all units installed on the system, use\n"
+ " the 'list-unit-files' command instead.\n"
" --failed Show only failed units\n"
" --full Don't ellipsize unit names on output\n"
" --fail When queueing a new job, fail if conflicting jobs are\n"
" --failed Show only failed units\n"
" --full Don't ellipsize unit names on output\n"
" --fail When queueing a new job, fail if conflicting jobs are\n"