From 66cead0a5beb2d94468ec132c6f991698742a3f8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 19 Oct 2016 21:05:26 +0100 Subject: [PATCH] init: trivial error path fix --- Applications/util/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 */ -- 2.34.1