1 --- a/src/cmd/ksh93/sh/jobs.c
2 +++ b/src/cmd/ksh93/sh/jobs.c
7 -#if !defined(WCONTINUED) || !defined(WIFCONTINUED)
8 +#if !defined(WCONTINUED) || !defined(WIFCONTINUED) || defined(__APPLE__)
12 @@ -664,6 +664,9 @@ static void job_reset(register struct process *pw)
13 /* save the terminal state for current job */
15 job_fgrp(pw,tcgetpgrp(job.fd));
17 + signal(SIGTTOU, SIG_IGN);
19 if(tcsetpgrp(job.fd,job.mypid) !=0)
22 @@ -1529,7 +1532,7 @@ static struct process *job_unpost(register struct process *pwtop,int notify)
25 /* all processes complete, unpost job */
27 + if (pwtop) job_unlink(pwtop);
28 for(pw=pwtop; pw; pw=pw->p_nxtproc)
30 /* save the exit status for background jobs */
31 @@ -1558,7 +1561,7 @@ static struct process *job_unpost(register struct process *pwtop,int notify)
32 sfprintf(sfstderr,"ksh: job line %4d: free pid=%d critical=%d job=%d\n",__LINE__,getpid(),job.in_critical,pwtop->p_job);
35 - job_free((int)pwtop->p_job);
36 + if (pwtop) job_free((int)pwtop->p_job);
37 return((struct process*)0);