ignoring a process' last words: SIGPIPE ...

Avery Pennarun apenwarr at gmail.com
Thu Mar 27 20:32:04 PDT 2008


On Thu, Mar 27, 2008 at 10:23 PM, Michael Meeks
<michael.meeks at novell.com> wrote:
>         But the patch AFAICS doesn't force anything, let along anything
>  immediate - it just defers closing the connection until we hit the
>  polling mainloop & after we have processed any pending reads - which is
>  what we want - right ?

Again, you can't be certain that just because your write() received
EPIPE, your next read() will be the last one.  There might yet be
unreceived data packets out on the net, about to be dropped into the
read() kernel buffer.

It would be better to ignore EPIPE on write() altogether (pretend it
== success) and wait as usual for read() to return 0 or error.  Then
you *know* you've drained the input queue, and you don't need to have
*any* special cases.

Basically, I don't understand why there's any messing with HANGUP
flags and the like.  If read() returns zero, you're done; if it
doesn't, or you haven't called read() yet, you're not.

Have fun,

Avery


More information about the dbus mailing list