passfd: give nicer error for recvfd at eof
authorEric Blake <eblake@redhat.com>
Tue, 24 Dec 2013 18:16:07 +0000 (11:16 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 24 Dec 2013 18:21:44 +0000 (11:21 -0700)
commitbeae0bdcf7fe30f2415c16f6b8c1368d469e519c
tree4529385bc9bd310fd584f1017e71d7f232e1610d
parent0ac90c5a98030c998f3e1db3a0d7f19d4630b6b6
passfd: give nicer error for recvfd at eof

I noticed that recvfd() fails with errno set to EACCES if the
other end of the socket has closed (such as if it calls _exit());
but "Permission denied" as the strerror() message doesn't read
very well.  This improves things to give the nicer message:
"Transport endpoint is not connected".

* lib/passfd.c (recvfd): Fake ENOTCONN if other end closes early.
* tests/test-passfd.c (main): Enhance test to cover this.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/passfd.c
tests/test-passfd.c