24 lines
605 B
Plaintext
24 lines
605 B
Plaintext
|
--- src/cmd/ksh93/sh/fault.c
|
||
|
+++ src/cmd/ksh93/sh/fault.c 2009-08-24 15:52:21.770401660 +0200
|
||
|
@@ -413,6 +413,20 @@ void sh_chktrap(void)
|
||
|
sh.sigflag[sig] &= ~SH_SIGTRAP;
|
||
|
if(trap=sh.st.trapcom[sig])
|
||
|
{
|
||
|
+ if (sig==SIGPIPE) {
|
||
|
+ int fd;
|
||
|
+ sh.lastsig=SIGPIPE;
|
||
|
+ for(fd = 0; fd < sh.lim.open_max; fd++)
|
||
|
+ {
|
||
|
+ if (sh.fdstatus[fd] == IOCLOSE)
|
||
|
+ continue;
|
||
|
+ if ((sh.fdstatus[fd]&IOWRITE) == 0)
|
||
|
+ continue;
|
||
|
+ if (sferror(sh.sftable[fd]) == 0)
|
||
|
+ continue;
|
||
|
+ sh_close(fd);
|
||
|
+ }
|
||
|
+ }
|
||
|
sh.oldexit = SH_EXITSIG|sig;
|
||
|
sh_trap(trap,0);
|
||
|
}
|