From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Add SIGCHLD catch to psql |
Date: | 2010-05-17 16:49:27 |
Message-ID: | 20100517164927.GG21875@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Stephen Frost <sfrost(at)snowman(dot)net> writes:
> > Attached is a patch that just checks the result from the existing
> > fflush() inside the FETCH_COUNT loop and drops out of that loop if we
> > get an error from it.
>
> I thought it might be about that simple once you went at it the right
> way ;-). However, I'd suggest checking ferror(pset.queryFout) as well
> as the fflush result. It's not clear to me whether fflush should be
> counted on to report an error that actually occurred in a previous
> fwrite. (It's also unclear why fflush isn't documented to set the stream
> error indicator on failure, but it isn't.)
Sure, I can add the ferror() check. Patch attached.
My man page (Debian/Linux) has this to say about fflush():
DESCRIPTION
The function fflush() forces a write of all user-space buffered
data for the given output or update stream via the stream’s
underlying write function. The open status of the stream
is unaffected.
If the stream argument is NULL, fflush() flushes all open output
streams.
For a non-locking counterpart, see unlocked_stdio(3).
RETURN VALUE
Upon successful completion 0 is returned. Otherwise, EOF is
returned and the global variable errno is set to indicate the
error.
ERRORS
EBADF Stream is not an open stream, or is not open for writing.
The function fflush() may also fail and set errno for any of the
errors specified for the routine write(2).
CONFORMING TO
C89, C99.
Thanks,
Stephen
Attachment | Content-Type | Size |
---|---|---|
psql-check-fflush-20100517-2.diff | text/x-diff | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2010-05-17 17:45:14 | Re: Partitioning/inherited tables vs FKs |
Previous Message | Andrew Dunstan | 2010-05-17 16:36:47 | Re: release notes |