Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27ea54d1944161d254053cf33541290d > files > 28

ksh-20100621-5.el5_8.1.src.rpm

diff -up ksh-20100621/src/cmd/ksh93/sh/fault.c.samesig ksh-20100621/src/cmd/ksh93/sh/fault.c
--- ksh-20100621/src/cmd/ksh93/sh/fault.c.samesig	2010-06-17 08:09:42.000000000 +0200
+++ ksh-20100621/src/cmd/ksh93/sh/fault.c	2011-02-03 16:53:58.764008496 +0100
@@ -39,6 +39,7 @@
 #define abortsig(sig)	(sig==SIGABRT || sig==SIGBUS || sig==SIGILL || sig==SIGSEGV)
 
 static char	indone;
+static int	cursig = -1;
 
 #if !_std_malloc
 #   include	<vmalloc.h>
@@ -408,6 +409,8 @@ void	sh_chktrap(void)
 #endif /* SHOPT_BGX */
 	while(--sig>=0)
 	{
+		if(sig==cursig)
+			continue;
 #ifdef SHOPT_BGX
 		if(sig==SIGCHLD)
 			continue;
@@ -417,11 +420,9 @@ void	sh_chktrap(void)
 			sh.sigflag[sig] &= ~SH_SIGTRAP;
 			if(trap=sh.st.trapcom[sig])
 			{
-				Sfio_t *fp;
-				if(sig==SIGPIPE && (fp=sfpool((Sfio_t*)0,sh.outpool,SF_WRITE)) && sferror(fp))
-					sfclose(fp);
- 				sh.oldexit = SH_EXITSIG|sig;
+				cursig = sig;
  				sh_trap(trap,0);
+				cursig = -1;
  			}
 		}
 	}
@@ -505,6 +506,8 @@ void sh_exit(register int xno)
 	shp->exitval=xno;
 	if(xno==SH_EXITSIG)
 		shp->exitval |= (sig=shp->lastsig);
+	if(pp && pp->mode>1)
+		cursig = -1;
 #ifdef SIGTSTP
 	if(shp->trapnote&SH_SIGTSTP)
 	{
diff -up ksh-20100621/src/cmd/ksh93/sh/io.c.samesig ksh-20100621/src/cmd/ksh93/sh/io.c
--- ksh-20100621/src/cmd/ksh93/sh/io.c.samesig	2010-06-10 21:09:46.000000000 +0200
+++ ksh-20100621/src/cmd/ksh93/sh/io.c	2011-02-03 16:54:25.850175504 +0100
@@ -1940,7 +1940,7 @@ static int pipeexcept(Sfio_t* iop, int m
 	NOT_USED(iop);
 	if(mode==SF_DPOP || mode==SF_FINAL)
 		free((void*)handle);
-	else if(mode==SF_WRITE && errno==EINTR && sh.lastsig==SIGPIPE)
+	else if(mode==SF_WRITE && errno==EINTR)
 		return(-1);
 	return(0);
 }
diff -up ksh-20100621/src/cmd/ksh93/tests/signal.sh.samesig ksh-20100621/src/cmd/ksh93/tests/signal.sh
--- ksh-20100621/src/cmd/ksh93/tests/signal.sh.samesig	2010-05-29 08:08:24.000000000 +0200
+++ ksh-20100621/src/cmd/ksh93/tests/signal.sh	2011-02-03 16:52:35.632495244 +0100
@@ -237,10 +237,10 @@ expected[---]="3-intr"
 expected[--d]="3-intr"
 expected[-t-]="3-intr 2-intr 1-intr 1-0258"
 expected[-td]="3-intr 2-intr 1-intr 1-0258"
-expected[x--]="3-intr 2-intr"
-expected[x-d]="3-intr 2-intr"
-expected[xt-]="3-intr 2-intr 1-intr 1-0258"
-expected[xtd]="3-intr 2-intr 1-intr 1-0258"
+expected[x--]="3-intr 2-intr 1-0000"
+expected[x-d]="3-intr 2-intr 1-0000"
+expected[xt-]="3-intr 2-intr 1-intr 1-0000"
+expected[xtd]="3-intr 2-intr 1-intr 1-0000"
 expected[z--]="3-intr 2-intr 1-0000"
 expected[z-d]="3-intr 2-intr 1-0000"
 expected[zt-]="3-intr 2-intr 1-intr 1-0000"