mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-04 00:12:33 +02:00
httpserver: Preserve socket error from listen across closesocket cleanup
This commit is contained in:
parent
68ab78ad2e
commit
100767324b
@ -410,13 +410,16 @@ my_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t
|
||||
{
|
||||
evutil_socket_t fd;
|
||||
struct evhttp_bound_socket *bound;
|
||||
int serrno;
|
||||
|
||||
if ((fd = bind_socket(address, port, 1 /*reuse*/)) == -1)
|
||||
return (NULL);
|
||||
|
||||
if (listen(fd, 128) == -1) {
|
||||
serrno = EVUTIL_SOCKET_ERROR();
|
||||
event_sock_warn(fd, "%s: listen", __func__);
|
||||
evutil_closesocket(fd);
|
||||
EVUTIL_SET_SOCKET_ERROR(serrno);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user