Move up waitpid error check so that errno isn't clobbered by tcsetpgrp.
This commit is contained in:
parent
adcbc12d85
commit
80abc45182
6
hush.c
6
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user