iotivity; fix sending partial data when error happens while constructing
discovery response.


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/b43a21f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b43a21f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b43a21f3

Branch: refs/heads/develop
Commit: b43a21f389948d62ba81219d944b6a308ac04a23
Parents: c1aab98
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Sep 20 14:09:08 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Sep 20 14:09:08 2016 -0700

----------------------------------------------------------------------
 libs/iotivity/src/api/oc_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b43a21f3/libs/iotivity/src/api/oc_discovery.c
----------------------------------------------------------------------
diff --git a/libs/iotivity/src/api/oc_discovery.c 
b/libs/iotivity/src/api/oc_discovery.c
index 34d34b8..e8ca760 100644
--- a/libs/iotivity/src/api/oc_discovery.c
+++ b/libs/iotivity/src/api/oc_discovery.c
@@ -156,7 +156,7 @@ oc_core_discovery_handler(oc_request_t *request, 
oc_interface_mask_t interface)
 
   int response_length = oc_rep_finalize();
 
-  if (matches && response_length) {
+  if (matches && response_length > 0) {
     request->response->response_buffer->response_length = response_length;
     request->response->response_buffer->code = oc_status_code(OC_STATUS_OK);
   } else {

Reply via email to