Minor makesock() fixes.
authorAndre Noll <maan@systemlinux.org>
Sun, 10 Oct 2010 16:51:17 +0000 (18:51 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 14 Nov 2010 14:42:21 +0000 (15:42 +0100)
commite5f02e0748de02eabfb8e0746af09eb676ec1dc0
tree907f150d7a92ff8d6be06f2dda6b592e94c6703f
parent5526ae874e5b333693ebb163848834256fcf4b20
Minor makesock() fixes.

On getaddrinfo() or setsockopt() errors, we leak the flowopts and/or
the local/remote address info structure. Fix this by jumping to the
cleanup section at the bottom of makesock() rather than returning
early without cleaning up.

Moreover, we can not rely on errno containing a valid error code in the
cleanup part of the function because flowopt_cleanup() calls free()
which usually resets errno. So use the error code provided via "rc"
if possible and fall back to the new -E_MAKESOCK if rc is non-negative
to make sure we return a negative value on errors.
error.h
net.c