ksh/ksh93-sigtstp.dif

101 lines
2.7 KiB
Plaintext

--- src/cmd/ksh93/sh/jobs.c
+++ src/cmd/ksh93/sh/jobs.c 2007-11-22 14:28:03.000000000 +0000
@@ -229,7 +229,7 @@ int job_reap(register int sig)
flags |= WNOHANG;
}
pid = waitpid((pid_t)-1,&wstat,flags);
-
+#ifdef WCONTINUED
/*
* some systems (linux 2.6) may return EINVAL
* when there are no continued children
@@ -237,6 +237,7 @@ int job_reap(register int sig)
if (pid<0 && errno==EINVAL && (flags&WCONTINUED))
pid = waitpid((pid_t)-1,&wstat,flags&=~WCONTINUED);
+#endif
sh_sigcheck();
if(sig && pid<0 && errno==EINTR)
continue;
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2007-11-22 14:33:05.000000000 +0000
@@ -2755,6 +2755,7 @@ static pid_t sh_ntfork(const Shnode_t *t
{
signal(SIGTTIN,SIG_DFL);
signal(SIGTTOU,SIG_DFL);
+ signal(SIGTSTP,SIG_DFL);
}
#endif /* SIGTSTP */
#ifdef JOBS
@@ -2792,6 +2793,10 @@ static pid_t sh_ntfork(const Shnode_t *t
{
signal(SIGTTIN,SIG_IGN);
signal(SIGTTOU,SIG_IGN);
+ if(sh_isstate(SH_INTERACTIVE))
+ signal(SIGTSTP, SIG_IGN);
+ else
+ signal(SIGTSTP, sh_fault);
}
#endif /* SIGTSTP */
if(spawnpid>0)
@@ -2876,6 +2881,7 @@ static pid_t sh_ntfork(const Shnode_t *t
{
signal(SIGTTIN,SIG_DFL);
signal(SIGTTOU,SIG_DFL);
+ signal(SIGTSTP,SIG_DFL);
jobwasset++;
}
#endif /* SIGTSTP */
@@ -2916,12 +2922,24 @@ static pid_t sh_ntfork(const Shnode_t *t
argv[0] = argv[-1];
}
fail:
- if(spawnpid < 0) switch(errno=shp->path_err)
+ if(spawnpid < 0)
{
- case ENOENT:
- errormsg(SH_DICT,ERROR_system(ERROR_NOENT),e_found+4);
- default:
- errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4);
+ if(jobwasset)
+ {
+ signal(SIGTTIN,SIG_IGN);
+ signal(SIGTTOU,SIG_IGN);
+ if(sh_isstate(SH_INTERACTIVE))
+ signal(SIGTSTP, SIG_IGN);
+ else
+ signal(SIGTSTP, sh_fault);
+ }
+ switch(errno=shp->path_err)
+ {
+ case ENOENT:
+ errormsg(SH_DICT,ERROR_system(ERROR_NOENT),e_found+4);
+ default:
+ errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4);
+ }
}
}
else
@@ -2934,6 +2952,10 @@ static pid_t sh_ntfork(const Shnode_t *t
{
signal(SIGTTIN,SIG_IGN);
signal(SIGTTOU,SIG_IGN);
+ if(sh_isstate(SH_INTERACTIVE))
+ signal(SIGTSTP, SIG_IGN);
+ else
+ signal(SIGTSTP, sh_fault);
}
#endif /* SIGTSTP */
if(sigwasset)
--- src/cmd/ksh93/edit/edit.c
+++ src/cmd/ksh93/edit/edit.c 2007-11-22 14:26:34.000000000 +0000
@@ -216,7 +216,7 @@ int tty_set(int fd, int action, struct t
if(fd >=0)
{
#ifdef future
- if(ep->e_savefd>=0 && compare(&ep->e_savetty,tty,sizeof(struct termios)))
+ if(ep->e_savefd>=0 && memcmp(&ep->e_savetty,tty,sizeof(struct termios)))
return(0);
#endif
while(tcsetattr(fd, action, tty) == SYSERR)