mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 22:56:00 +00:00
lwip_accept(): check netconn_peer() error return.
This commit is contained in:
parent
d64b3f21e6
commit
0b4402ebc8
|
@ -196,6 +196,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
u16_t port;
|
u16_t port;
|
||||||
int newsock;
|
int newsock;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
|
err_t err;
|
||||||
|
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
|
||||||
sock = get_socket(s);
|
sock = get_socket(s);
|
||||||
|
@ -210,7 +211,12 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the IP address and port of the remote host */
|
/* get the IP address and port of the remote host */
|
||||||
netconn_peer(newconn, &naddr, &port);
|
err = netconn_peer(newconn, &naddr, &port);
|
||||||
|
if (err != ERR_OK) {
|
||||||
|
netconn_delete(newconn);
|
||||||
|
sock_set_errno(sock, err_to_errno(err));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&sin, 0, sizeof(sin));
|
memset(&sin, 0, sizeof(sin));
|
||||||
sin.sin_len = sizeof(sin);
|
sin.sin_len = sizeof(sin);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user