net: lwm2m: response to peer with correct error code when write fail

Update the firmware update_result accordingly by checking return
value of the firmware data write callback registered by application.
Also, set response code according.

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
This commit is contained in:
Robert Chou 2017-11-02 18:36:24 +08:00 committed by Jukka Rissanen
commit 3ad6719fbf
3 changed files with 51 additions and 39 deletions

View file

@ -2674,6 +2674,8 @@ error:
msg->code = COAP_RESPONSE_CODE_NOT_ALLOWED;
} else if (r == -EEXIST) {
msg->code = COAP_RESPONSE_CODE_BAD_REQUEST;
} else if (r == -EFAULT) {
msg->code = COAP_RESPONSE_CODE_INCOMPLETE;
} else if (r == -EFBIG) {
msg->code = COAP_RESPONSE_CODE_REQUEST_TOO_LARGE;
} else {