src__cmd__ksh93__jobs.c.diff [plain text]
--- src/cmd/ksh93/sh/jobs.c~ 2007-07-03 19:27:28.000000000 -0700
+++ src/cmd/ksh93/sh/jobs.c 2007-07-03 19:28:02.000000000 -0700
@@ -36,7 +36,7 @@
#include "jobs.h"
#include "history.h"
-#if !defined(WCONTINUED) || !defined(WIFCONTINUED)
+#if !defined(WCONTINUED) || !defined(WIFCONTINUED) || defined(__APPLE__)
# undef WCONTINUED
# define WCONTINUED 0
# undef WIFCONTINUED
@@ -598,6 +598,9 @@ static void job_reset(register struct pr
/* save the terminal state for current job */
#ifdef SIGTSTP
job_fgrp(pw,tcgetpgrp(job.fd));
+#ifdef SIGTTOU
+ signal(SIGTTOU, SIG_IGN);
+#endif /* SIGTTOU */
if(tcsetpgrp(job.fd,sh.pid) !=0)
return;
#endif /* SIGTSTP */
@@ -1440,7 +1443,7 @@ static struct process *job_unpost(regist
if(pw)
return(pw);
/* all processes complete, unpost job */
- job_unlink(pwtop);
+ if (pwtop) job_unlink(pwtop);
for(pw=pwtop; pw; pw=pw->p_nxtproc)
{
/* save the exit status for background jobs */
@@ -1469,7 +1472,7 @@ static struct process *job_unpost(regist
sfprintf(sfstderr,"ksh: job line %4d: free pid=%d critical=%d job=%d\n",__LINE__,getpid(),job.in_critical,pwtop->p_job);
sfsync(sfstderr);
#endif /* DEBUG */
- job_free((int)pwtop->p_job);
+ if (pwtop) job_free((int)pwtop->p_job);
return((struct process*)0);
}