mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-05 22:44:50 +02:00
httpserver: Preserve socket error from listen across closesocket cleanup
This commit is contained in:
parent
91716a8661
commit
1a6dd1ff1b
@ -459,13 +459,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