bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]
Date: Mon, 27 Mar 2017 15:01:55 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Mon, Mar 27, 2017 at 12:50:07PM -0600, address@hidden wrote:
> I think I have it all straightened out now.  If not, it's good enough
> until some future date or someone else wants to tackle it.

Wow, that's almost as sleazy as something I would do. :-)
#define die_via_sigpipe() (signal(SIGPIPE, SIG_DFL), kill(getpid(), SIGPIPE))

I think you have a trivial bug in main.c:usage where it says:

        if (ferror(fp)) {
                /* don't warn about stdout/stderr if EPIPE, but do error exit */
                if (errno != EPIPE) {
                        if (fp == stdout)
                                warning(_("error writing standard output 
(%s)"), strerror(errno));
                        else if (fp == stderr)
                                warning(_("error writing standard error (%s)"), 
strerror(errno));
                } else if (errno == SIGPIPE)
                        die_via_sigpipe();

                // some other problem than SIGPIPE
                exit(EXIT_FAILURE);
        }

I think that "if (errno == SIGPIPE)" test should be removed.

Regards,
Andy



reply via email to

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