socket-util: make sure flush_accept() doesn't hang on unexpected EOPNOTSUPP
authorLennart Poettering <lennart@poettering.net>
Thu, 18 Apr 2019 13:13:54 +0000 (15:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Apr 2019 13:18:12 +0000 (15:18 +0200)
commitf3d75364fbebf2ddb6393e54db5e10b6f6234e14
tree90992f0624493c0166aff497cc39a10bf54c9d98
parent528fcf8d1d06f18aed6fd8c90a1ab0530b4f4ba3
socket-util: make sure flush_accept() doesn't hang on unexpected EOPNOTSUPP

So apparently there are two reasons why accept() can return EOPNOTSUPP:
because the socket is not a listening stream socket (or similar), or
because the incoming TCP connection for some reason wasn't acceptable to
the host. THe latter should be a transient error, as suggested on
accept(2). The former however should be considered fatal for
flush_accept(). Let's fix this by explicitly checking whether the socket
is a listening socket beforehand.
src/basic/socket-util.c