mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 00:15:16 +00:00
pbuf_take: make it comply with API specifications
LWIP_ERROR macro exited the function early with the return code indicating a SUCCESS. Fix the error codes. Return the specified error code for cases when the pbuf is too short.
This commit is contained in:
parent
72b3f3f612
commit
52a4ca99a8
@ -1086,8 +1086,9 @@ pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
|
||||
u16_t total_copy_len = len;
|
||||
u16_t copied_total = 0;
|
||||
|
||||
LWIP_ERROR("pbuf_take: invalid buf", (buf != NULL), return 0;);
|
||||
LWIP_ERROR("pbuf_take: invalid dataptr", (dataptr != NULL), return 0;);
|
||||
LWIP_ERROR("pbuf_take: invalid buf", (buf != NULL), return ERR_ARG;);
|
||||
LWIP_ERROR("pbuf_take: invalid dataptr", (dataptr != NULL), return ERR_ARG;);
|
||||
LWIP_ERROR("pbuf_take: buf not large enough", (buf->tot_len >= len), return ERR_MEM;);
|
||||
|
||||
if ((buf == NULL) || (dataptr == NULL) || (buf->tot_len < len)) {
|
||||
return ERR_ARG;
|
||||
|
Loading…
Reference in New Issue
Block a user