From: Alan Cox Date: Wed, 19 Oct 2016 20:05:26 +0000 (+0100) Subject: init: trivial error path fix X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=66cead0a5beb2d94468ec132c6f991698742a3f8;p=FUZIX.git init: trivial error path fix --- diff --git a/Applications/util/init.c b/Applications/util/init.c index 78988446..46cb0909 100644 --- a/Applications/util/init.c +++ b/Applications/util/init.c @@ -137,8 +137,9 @@ static pid_t spawn_process(uint8_t * p, uint8_t wait) /* Check for internal processes */ if (strcmp(args[2], "getty") == 0) - pid = getty(args + 3, p + 1); - else { + if ((pid = getty(args + 3, p + 1) == -1) + return 0; + } else { /* External */ pid = fork(); if (pid == -1) { @@ -712,6 +713,7 @@ static pid_t getty(const char **argv, const char *id) pid = fork(); if (pid == -1) { putstr("init: can't fork\n"); + return -1; } else { if (pid != 0) /* parent's context: return pid of the child process */