1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

nanocoap_sock: use correct error code in nanocoap_get_blockwise_url_to_buf()

It should return -ENOBUFS like the other nanocoap_…() functions, not -1
This commit is contained in:
Benjamin Valentin 2022-09-05 02:41:45 +02:00
parent 711f4df101
commit 37dceb6c80
2 changed files with 3 additions and 2 deletions

View File

@ -308,8 +308,9 @@ int nanocoap_get_blockwise_url(const char *url,
* @param[in] buf Target buffer
* @param[in] len Target buffer length
*
* @returns <0 on error
* @returns -EINVAL if an invalid url is provided
* @returns -1 if failed to fetch the url content
* @returns -ENOBUFS if the provided buffer was too small
* @returns size of the response payload on success
*/
ssize_t nanocoap_get_blockwise_url_to_buf(const char *url,

View File

@ -568,7 +568,7 @@ static int _2buf(void *arg, size_t offset, uint8_t *buf, size_t len, int more)
_buf_t *dst = arg;
if (offset + len > dst->len) {
return -1;
return -ENOBUFS;
}
memcpy(dst->ptr + offset, buf, len);