From: Matt Kraai Date: Wed, 2 May 2001 21:48:17 +0000 (-0000) Subject: Move up waitpid error check so that errno isn't clobbered by tcsetpgrp. X-Git-Tag: 0_52~247 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=80abc45182ff8a526968d199add198f979875c77;p=oweals%2Fbusybox.git Move up waitpid error check so that errno isn't clobbered by tcsetpgrp. --- diff --git a/hush.c b/hush.c index 4a16a3fa6..a7316f82e 100644 --- a/hush.c +++ b/hush.c @@ -1148,12 +1148,12 @@ static void checkjobs() } } + if (childpid == -1 && errno != ECHILD) + perror_msg("waitpid"); + /* move the shell to the foreground */ if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY) perror_msg("tcsetpgrp"); - - if (childpid == -1 && errno != ECHILD) - perror_msg("waitpid"); } /* run_pipe_real() starts all the jobs, but doesn't wait for anything diff --git a/shell/hush.c b/shell/hush.c index 4a16a3fa6..a7316f82e 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1148,12 +1148,12 @@ static void checkjobs() } } + if (childpid == -1 && errno != ECHILD) + perror_msg("waitpid"); + /* move the shell to the foreground */ if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY) perror_msg("tcsetpgrp"); - - if (childpid == -1 && errno != ECHILD) - perror_msg("waitpid"); } /* run_pipe_real() starts all the jobs, but doesn't wait for anything