chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reject invalid quoted strings
[elogind.git]
/
src
/
systemctl
/
systemctl.c
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index f3d7fc8d6e5c0573a5e7442180e1b41ce7c5c0ab..21e33d5bfc9607de6b4c8066bdddf6f850126d31 100644
(file)
--- a/
src/systemctl/systemctl.c
+++ b/
src/systemctl/systemctl.c
@@
-1142,7
+1142,7
@@
static usec_t calc_next_elapse(dual_timestamp *nw, dual_timestamp *next) {
assert(nw);
assert(next);
assert(nw);
assert(next);
- if (next->monotonic !=
(usec_t) -1
&& next->monotonic > 0) {
+ if (next->monotonic !=
USEC_INFINITY
&& next->monotonic > 0) {
usec_t converted;
if (next->monotonic > nw->monotonic)
usec_t converted;
if (next->monotonic > nw->monotonic)
@@
-1150,7
+1150,7
@@
static usec_t calc_next_elapse(dual_timestamp *nw, dual_timestamp *next) {
else
converted = nw->realtime - (nw->monotonic - next->monotonic);
else
converted = nw->realtime - (nw->monotonic - next->monotonic);
- if (next->realtime !=
(usec_t) -1
&& next->realtime > 0)
+ if (next->realtime !=
USEC_INFINITY
&& next->realtime > 0)
next_elapse = MIN(converted, next->realtime);
else
next_elapse = converted;
next_elapse = MIN(converted, next->realtime);
else
next_elapse = converted;
@@
-4998,14
+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))
- j = asprintf(&path, "%s/%s/%s", arg_root, *k, name);
- else
- j = asprintf(&path, "%s/%s", *k, name);
- if (j < 0) {
- 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)
@@
-5015,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))
- j = asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
- else
- j = asprintf(&p, SYSTEM_SYSVINIT_PATH "/%s", name);
- if (j < 0) {
- 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;
@@
-5044,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 */
@@
-5066,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) {
@@
-5081,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++) {
@@
-5752,7
+5733,7
@@
static int systemctl_parse_argv(int argc, char *argv[]) {
return 0;
case 't': {
return 0;
case 't': {
- char *word, *state;
+ c
onst c
har *word, *state;
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
@@
-5801,7
+5782,7
@@
static int systemctl_parse_argv(int argc, char *argv[]) {
if (!arg_properties)
return log_oom();
} else {
if (!arg_properties)
return log_oom();
} else {
- char *word, *state;
+ c
onst c
har *word, *state;
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
@@
-5971,7
+5952,7
@@
static int systemctl_parse_argv(int argc, char *argv[]) {
break;
case ARG_STATE: {
break;
case ARG_STATE: {
- char *word, *state;
+ c
onst c
har *word, *state;
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {