mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #18848 from benpicco/coap_build_reply-return
examples: check return value of coap_build_reply()
This commit is contained in:
commit
13eef005ef
@ -150,6 +150,10 @@ ssize_t _sha256_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_request_
|
||||
}
|
||||
|
||||
ssize_t reply_len = coap_build_reply(pkt, result, buf, len, 0);
|
||||
if (reply_len <= 0) {
|
||||
return reply_len;
|
||||
}
|
||||
|
||||
uint8_t *pkt_pos = (uint8_t*)pkt->hdr + reply_len;
|
||||
if (blockwise) {
|
||||
pkt_pos += coap_opt_put_block1_control(pkt_pos, 0, &block1);
|
||||
|
@ -66,6 +66,10 @@ ssize_t _flashwrite_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_requ
|
||||
}
|
||||
|
||||
ssize_t reply_len = coap_build_reply(pkt, result, buf, len, 0);
|
||||
if (reply_len <= 0) {
|
||||
return reply_len;
|
||||
}
|
||||
|
||||
uint8_t *pkt_pos = (uint8_t*)pkt->hdr + reply_len;
|
||||
pkt_pos += coap_put_block1_ok(pkt_pos, &block1, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user