]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: connection: clear errno prior to checking for errors
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Dec 2013 23:49:40 +0000 (00:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Dec 2013 01:23:48 +0000 (02:23 +0100)
commitce3eda7c6a8e594cf690b3c2f8e35378e8601dfc
treed91a73d6342e733dd0df085d2646578f9a159290
parent67ff7e0af37d093dbceb56a353d84fa4ffd10a7e
MINOR: connection: clear errno prior to checking for errors

At some places, we report an error by just detecting FD_POLL_ERR.
The problem is that the caller never knows if it must use errno or
call getsockopt(SO_ERROR). And since this last one clears the
pending error from the queue, it cannot be used inconditionally.

An elegant solution consists in clearing errno prior to inspecting
FD_POLL_ERR. The caller then knows that if it gets CO_FL_ERROR and
errno == 0, it must call getsockopt().
src/raw_sock.c