mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
http: Preserve socket error from listen across closesocket cleanup
Closes: #738 (cherry-picked)
This commit is contained in:
parent
246f44041e
commit
28d7221b85
3
http.c
3
http.c
@ -3544,13 +3544,16 @@ evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint
|
||||
{
|
||||
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…
x
Reference in New Issue
Block a user