From 04a8a3673418db1e481ad41f8ef4f554b8b2bbc0 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 29 Apr 2022 21:29:36 +0200 Subject: [PATCH] nanocoap_sock: only abort nanocoap_sock_get_blockwise() on negative error Some user callbacks might just return the result of some other operation that returns written bytes or negative error. Let's not break those, only consider negative callback returns an error. --- sys/net/application_layer/nanocoap/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/application_layer/nanocoap/sock.c b/sys/net/application_layer/nanocoap/sock.c index cdd7cb8f32..2132fa9e57 100644 --- a/sys/net/application_layer/nanocoap/sock.c +++ b/sys/net/application_layer/nanocoap/sock.c @@ -403,7 +403,7 @@ int nanocoap_sock_get_blockwise(nanocoap_sock_t *sock, const char *path, DEBUG("fetching block %u\n", num); int res = _fetch_block(sock, buf, sizeof(buf), path, blksize, num, &ctx); - if (res) { + if (res < 0) { DEBUG("error fetching block %u: %d\n", num, res); return res; }