net: lwm2m: fix error code in read and write handlers
When a data pointer or data length is not set, the read and write handlers should return ENOENT to generate the correct LwM2M error code (COAP_RESPONSE_CODE_NOT_FOUND). Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
This commit is contained in:
parent
44c9b79a49
commit
cf55b70b4c
1 changed files with 3 additions and 1 deletions
|
@ -1870,7 +1870,7 @@ static int lwm2m_read_handler(struct lwm2m_engine_obj_inst *obj_inst,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data_ptr || data_len == 0) {
|
if (!data_ptr || data_len == 0) {
|
||||||
return -EINVAL;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res->multi_count_var != NULL) {
|
if (res->multi_count_var != NULL) {
|
||||||
|
@ -2180,6 +2180,8 @@ int lwm2m_write_handler(struct lwm2m_engine_obj_inst *obj_inst,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res->post_write_cb &&
|
if (res->post_write_cb &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue