fixed bug #33956 Wrong error returned when calling accept() on UDP connections

This commit is contained in:
Simon Goldschmidt 2011-08-24 21:12:12 +02:00 committed by goldsimon
parent e2cdf0d39d
commit 422e7963de
3 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,10 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2011-08-24: Simon Goldschmidt
* api_msg.c, sockets.c: fixed bug #33956 Wrong error returned when calling
accept() on UDP connections
2011-08-24: Simon Goldschmidt 2011-08-24: Simon Goldschmidt
* sockets.h: fixed bug #34057 socklen_t should be a typedef * sockets.h: fixed bug #34057 socklen_t should be a typedef

View File

@ -1089,6 +1089,8 @@ do_listen(struct api_msg_msg *msg)
} }
} }
} }
} else {
msg->err = ERR_ARG;
} }
} }
} }

View File

@ -336,6 +336,10 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
err = netconn_accept(sock->conn, &newconn); err = netconn_accept(sock->conn, &newconn);
if (err != ERR_OK) { if (err != ERR_OK) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
sock_set_errno(sock, EOPNOTSUPP);
return EOPNOTSUPP;
}
sock_set_errno(sock, err_to_errno(err)); sock_set_errno(sock, err_to_errno(err));
return -1; return -1;
} }
@ -537,6 +541,10 @@ lwip_listen(int s, int backlog)
if (err != ERR_OK) { if (err != ERR_OK) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d) failed, err=%d\n", s, err)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d) failed, err=%d\n", s, err));
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
sock_set_errno(sock, EOPNOTSUPP);
return EOPNOTSUPP;
}
sock_set_errno(sock, err_to_errno(err)); sock_set_errno(sock, err_to_errno(err));
return -1; return -1;
} }