> As you can see, read() doesn't return any error, just 0 to
> indicate end-of-file (seems correct interpretation of remote
> shutdown here), but it doesn't report any error from the
> precedent write... Bug ?
>
> Race, wait a bit, the reset will arrive.
Ok, I investigated this a bit more using setsockopt(...,SO_ERROR,...)
After the write in the client (which is done after the server has
shutdown()'ed it), the error bit is set on the client socket
(-EPIPE).
If the client issues a second write, the write fails (correctly)
setting errno to -EPIPE.
If the client issues a read, read doesn't return an error. The
socket error bit is still there however, even after read() returns.
If the client issues a close, close will return 0 too.
Whether the read() should return the error bit or not is
debatable, but IMHO close at least should propagate the error.
Stelian.
-- Stelian Pop <stelian.pop@fr.alcove.com> Alcove - http://www.alcove.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/