aboutsummaryrefslogtreecommitdiff
path: root/lib/init
diff options
context:
space:
mode:
Diffstat (limited to 'lib/init')
-rw-r--r--lib/init/rdsvc.c28
-rw-r--r--lib/init/svc_tsort.c2
2 files changed, 21 insertions, 9 deletions
diff --git a/lib/init/rdsvc.c b/lib/init/rdsvc.c
index c461d98..9992668 100644
--- a/lib/init/rdsvc.c
+++ b/lib/init/rdsvc.c
@@ -104,6 +104,7 @@ static int svc_exec(void *user, char *arg, rdline_t *rd)
static int svc_before(void *user, char *arg, rdline_t *rd)
{
service_t *svc = user;
+ int ret;
if (svc->before != NULL) {
fprintf(stderr, "%s: %zu: 'before' dependencies respecified\n",
@@ -115,13 +116,18 @@ static int svc_before(void *user, char *arg, rdline_t *rd)
if (svc->before == NULL)
return -1;
- svc->num_before = try_pack_argv(svc->before, rd);
- return (svc->num_before < 0) ? -1 : 0;
+ ret = try_pack_argv(svc->before, rd);
+ if (ret < 0)
+ return -1;
+
+ svc->num_before = ret;
+ return 0;
}
static int svc_after(void *user, char *arg, rdline_t *rd)
{
service_t *svc = user;
+ int ret;
if (svc->after != NULL) {
fprintf(stderr, "%s: %zu: 'after' dependencies respecified\n",
@@ -133,26 +139,32 @@ static int svc_after(void *user, char *arg, rdline_t *rd)
if (svc->after == NULL)
return -1;
- svc->num_after = try_pack_argv(svc->after, rd);
- return (svc->num_after < 0) ? -1 : 0;
+ ret = try_pack_argv(svc->after, rd);
+ if (ret < 0)
+ return -1;
+
+ svc->num_after = ret;
+ return 0;
}
static int svc_type(void *user, char *arg, rdline_t *rd)
{
service_t *svc = user;
- int count = try_pack_argv(arg, rd);
+ int ret, count;
+ count = try_pack_argv(arg, rd);
if (count < 1)
return -1;
- svc->type = svc_type_from_string(arg);
-
- if (svc->type == -1) {
+ ret = svc_type_from_string(arg);
+ if (ret < 0) {
fprintf(stderr, "%s: %zu: unknown service type '%s'\n",
rd->filename, rd->lineno, arg);
return -1;
}
+ svc->type = ret;
+
if (count > 1) {
arg += strlen(arg) + 1;
diff --git a/lib/init/svc_tsort.c b/lib/init/svc_tsort.c
index 37f3eb8..99feac8 100644
--- a/lib/init/svc_tsort.c
+++ b/lib/init/svc_tsort.c
@@ -9,7 +9,7 @@
static bool has_dependencies(service_t *list, service_t *svc)
{
const char *ptr;
- int i;
+ uint32_t i;
while (list != NULL) {
for (ptr = svc->after, i = 0; i < svc->num_after; ++i) {