Skip to content
Snippets Groups Projects
Unverified Commit c02ee081 authored by Kaspar Schleiser's avatar Kaspar Schleiser Committed by GitHub
Browse files

Merge pull request #7174 from miri64/gnrc_sock/fix/return-EINVAL-for-inval-sock

sock: specify invalid parameter error
parents 060d49fc ce0d81c5
No related branches found
No related tags found
No related merge requests found
......@@ -403,6 +403,8 @@ int sock_ip_get_remote(sock_ip_t *sock, sock_ip_ep_t *ep);
* @return 0, if no received data is available, but everything is in order.
* @return -EADDRNOTAVAIL, if local of @p sock is not given.
* @return -EAGAIN, if @p timeout is `0` and no data is available.
* @return -EINVAL, if @p remote is invalid or @p sock is not properly
* initialized (or closed while sock_ip_recv() blocks).
* @return -ENOBUFS, if buffer space is not large enough to store received
* data.
* @return -ENOMEM, if no memory was available to receive @p data.
......
......@@ -389,6 +389,8 @@ int sock_udp_get_remote(sock_udp_t *sock, sock_udp_ep_t *ep);
* @return 0, if no received data is available, but everything is in order.
* @return -EADDRNOTAVAIL, if local of @p sock is not given.
* @return -EAGAIN, if @p timeout is `0` and no data is available.
* @return -EINVAL, if @p remote is invalid or @p sock is not properly
* initialized (or closed while sock_udp_recv() blocks).
* @return -ENOBUFS, if buffer space is not large enough to store received
* data.
* @return -ENOMEM, if no memory was available to receive @p data.
......
......@@ -57,6 +57,9 @@ ssize_t gnrc_sock_recv(gnrc_sock_reg_t *reg, gnrc_pktsnip_t **pkt_out,
gnrc_pktsnip_t *pkt, *ip, *netif;
msg_t msg;
if (reg->mbox.cib.mask != (SOCK_MBOX_SIZE - 1)) {
return -EINVAL;
}
#ifdef MODULE_XTIMER
xtimer_t timeout_timer;
......@@ -89,7 +92,7 @@ ssize_t gnrc_sock_recv(gnrc_sock_reg_t *reg, gnrc_pktsnip_t **pkt_out,
#endif
/* Falls Through. */
default:
return -EINTR;
return -EINVAL;
}
/* TODO: discern NETTYPE from remote->family (set in caller), when IPv4
* was implemented */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment