ksh/ksh93-pipe.dif

22 lines
706 B
Plaintext

| From: David Korn <dgk@research.att.com>
| To: werner@suse.de
| Subject: Re: Re: [ast-users] Crash with SIGPIPE trap...
|
| OK, now I get what is causing this. Here is a simpler fix
| that I think should work. If the stream is in a pool, then
| this just purges the top level so that it doesn't write to
| that level.
|
--- src/cmd/ksh93/sh/fault.c
+++ src/cmd/ksh93/sh/fault.c 2009-08-24 15:52:21.770401660 +0200
@@ -413,6 +413,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)))
+ sfpurge(fp);
sh.oldexit = SH_EXITSIG|sig;
sh_trap(trap,0);
}