mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #7174 from miri64/gnrc_sock/fix/return-EINVAL-for-inval-sock
sock: specify invalid parameter error
This commit is contained in:
commit
c02ee081d9
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user