On Thu, May 31, 2012 at 11:26 PM, Roland Mainz <[email protected]> wrote:
> If the assumption below is correct (that an application has to handle
> both EPIPE and ECONRESET the same way) then some code in ksh93, libast
> and some utilties need to be updated. For example this fragment in
> io.c ...
> -- snip --
>        else if(mode==SF_WRITE && errno==EPIPE)
>        {
>                sfpurge(iop);
>                return(-1);
>        }
> -- snip --
> ... needs to be changed to:
> -- snip --
>        else if(mode==SF_WRITE && ((errno==EPIPE) || (errno==ECONNRESET)))
>        {
>                sfpurge(iop);
>                return(-1);
>        }
> -- snip --
>
> IMO a macro which tests for both EPIPE and ECONNRESET in an libast
> header would be usefull... example:
> -- snip --
> #define EPIPE_GONE(errn) (((errn)==EPIPE) || ((errn)==ECONNRESET))
> -- snip --

Correction... AFAIK the macro should look like this:
#ifdef ECONNRESET
#define EPIPE_GONE(errn) (((errn)==EPIPE) || ((errn)==ECONNRESET))
#else
#define EPIPE_GONE(errn) ((errn)==EPIPE)
#endif

AFAIK at least the following locations need to be updated:
-- snip --
src/cmd/builtin/od.c:   if (sfsync(sfstdout) && errno != EPIPE)
src/cmd/builtin/tr.c:           if (errno != EPIPE)
src/lib/libcmd/tee.c:   if ((sfmove(sfstdin, sfstdout, SF_UNBOUND, -1)
< 0 || !sfeof(sfstdin)) && errno != EPIPE && errno != EINTR)
src/lib/libcmd/head.c:          if (sfmove(fp, sfstdout, keep, delim)
< 0 && errno != EPIPE && errno != EINTR)
src/lib/libcmd/cat.c:           if (n < 0 && errno != EPIPE && errno != EINTR)
-- snip --

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to