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:
Robert Szewczyk 2015-09-16 16:50:35 -07:00 committed by goldsimon
parent 72b3f3f612
commit 52a4ca99a8

View File

@ -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;