sh: Don't leak wait* implementation details from jobs.c

This commit is contained in:
Jilles Tjoelker 2017-12-26 16:23:18 +00:00
parent 2fe0ea7324
commit c8a5f66527
2 changed files with 6 additions and 7 deletions

View File

@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/wait.h> /* For WIFSIGNALED(status) */
#include <errno.h>
/*
@ -840,7 +839,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
struct parsefile *savetopfile;
volatile int e;
char *lastarg;
int realstatus;
int signaled;
int do_clearcmdentry;
const char *path = pathval();
int i;
@ -1163,9 +1162,9 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
parent: /* parent process gets here (if we forked) */
if (mode == FORK_FG) { /* argument to fork */
INTOFF;
exitstatus = waitforjob(jp, &realstatus);
exitstatus = waitforjob(jp, &signaled);
INTON;
if (iflag && loopnest > 0 && WIFSIGNALED(realstatus)) {
if (iflag && loopnest > 0 && signaled) {
evalskip = SKIPBREAK;
skipcount = loopnest;
}

View File

@ -1016,7 +1016,7 @@ vforkexecshell(struct job *jp, char **argv, char **envp, const char *path, int i
*/
int
waitforjob(struct job *jp, int *origstatus)
waitforjob(struct job *jp, int *signaled)
{
#if JOBS
int propagate_int = jp->jobctl && jp->foreground;
@ -1039,8 +1039,8 @@ waitforjob(struct job *jp, int *origstatus)
setcurjob(jp);
#endif
status = jp->ps[jp->nprocs - 1].status;
if (origstatus != NULL)
*origstatus = status;
if (signaled != NULL)
*signaled = WIFSIGNALED(status);
/* convert to 8 bits */
if (WIFEXITED(status))
st = WEXITSTATUS(status);