bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] fatal: print to "standard output" failed (Broken pipe)


From: Andrew J. Schorr
Subject: Re: [bug-gawk] fatal: print to "standard output" failed (Broken pipe)
Date: Thu, 31 Oct 2013 15:30:55 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Thu, Oct 31, 2013 at 09:15:20PM +0200, Aharon Robbins wrote:
> +2013-10-31         Arnold D. Robbins     <address@hidden>
> +
> +     * builtin.c (efwrite): Ignore EPIPE on stdout if write error.
> +     Thanks to Hermann Peifer for helping root this one out.
> +
>  2013-10-22         Arnold D. Robbins     <address@hidden>
>  
>       Revise error messages when writing to standard output or standard
> diff --git a/builtin.c b/builtin.c
> index 9258ea6..f558fc9 100644
> --- a/builtin.c
> +++ b/builtin.c
> @@ -125,9 +125,11 @@ efwrite(const void *ptr,
>       return;
>  
>  wrerror:
> -     fatal(_("%s to \"%s\" failed (%s)"), from,
> -             rp ? rp->value : _("standard output"),
> -             errno ? strerror(errno) : _("reason unknown"));
> +     /* don't fatal on EPIPE to stdout */
> +     if (fp != stdout || errno != EPIPE)
> +             fatal(_("%s to \"%s\" failed (%s)"), from,
> +                     rp ? rp->value : _("standard output"),
> +                     errno ? strerror(errno) : _("reason unknown"));
>  }
>  
>  /* do_exp --- exponential function */

This is perhaps a stupid question, but it seems as if this patch
may result in the program's not exiting due to the write error.
I can understand that it may not be desirable to print the error
message, but is it clear that the program should not exit?

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]