sh: Don't leak wait* implementation details from jobs.c
This commit is contained in:
parent
643c4b60a8
commit
6f728e58bf
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user