mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-17 02:23:49 +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:
parent
711f4df101
commit
37dceb6c80
@ -308,8 +308,9 @@ int nanocoap_get_blockwise_url(const char *url,
|
|||||||
* @param[in] buf Target buffer
|
* @param[in] buf Target buffer
|
||||||
* @param[in] len Target buffer length
|
* @param[in] len Target buffer length
|
||||||
*
|
*
|
||||||
|
* @returns <0 on error
|
||||||
* @returns -EINVAL if an invalid url is provided
|
* @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
|
* @returns size of the response payload on success
|
||||||
*/
|
*/
|
||||||
ssize_t nanocoap_get_blockwise_url_to_buf(const char *url,
|
ssize_t nanocoap_get_blockwise_url_to_buf(const char *url,
|
||||||
|
|||||||
@ -568,7 +568,7 @@ static int _2buf(void *arg, size_t offset, uint8_t *buf, size_t len, int more)
|
|||||||
_buf_t *dst = arg;
|
_buf_t *dst = arg;
|
||||||
|
|
||||||
if (offset + len > dst->len) {
|
if (offset + len > dst->len) {
|
||||||
return -1;
|
return -ENOBUFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(dst->ptr + offset, buf, len);
|
memcpy(dst->ptr + offset, buf, len);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user