You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/05 19:09:59 UTC

incubator-mynewt-core git commit: newtmgr - increase hdr-len to account for err code

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 290c6839f -> c694835ef


newtmgr - increase hdr-len to account for err code

This addresses a bug in transmission of newtmgr error responses.  For
outgoing error responses, the header always indicated a length of 0.
The fix is to adjust the header's length to account for the error code
field.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/c694835e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c694835e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c694835e

Branch: refs/heads/develop
Commit: c694835ef8cca79f672263582d563ad3e393823a
Parents: 290c683
Author: Christopher Collins <cc...@apache.org>
Authored: Sat Nov 5 12:10:00 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Nov 5 12:10:00 2016 -0700

----------------------------------------------------------------------
 mgmt/newtmgr/src/newtmgr.c | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c694835e/mgmt/newtmgr/src/newtmgr.c
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/src/newtmgr.c b/mgmt/newtmgr/src/newtmgr.c
index f54d552..bd7474d 100644
--- a/mgmt/newtmgr/src/newtmgr.c
+++ b/mgmt/newtmgr/src/newtmgr.c
@@ -100,7 +100,11 @@ nmgr_send_err_rsp(struct nmgr_transport *nt, struct os_mbuf *m,
     if (!hdr) {
         return;
     }
+
     mgmt_cbuf_setoerr(&nmgr_task_cbuf.n_b, rc);
+    hdr->nh_len +=
+        cbor_encode_bytes_written(&nmgr_task_cbuf.n_b.encoder);
+
     hdr->nh_len = htons(hdr->nh_len);
     hdr->nh_flags = NMGR_F_CBOR_RSP_COMPLETE;
     nt->nt_output(nt, nmgr_task_cbuf.n_out_m);