This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d57b34  net/oic: Fail init if any interface fails
9d57b34 is described below

commit 9d57b349ddca9832e1ecf80c47af96f456f8faf1
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Mon Jun 15 15:45:36 2020 -0700

    net/oic: Fail init if any interface fails
    
    oc_connectivity_init() would succeed if at least one interface was
    successfully initialized.  This allowed interfaces to silently fail.
    
    This commit changes oc_connectivity_init() so that it fails unless *all*
    interfaces successfully initialize.
---
 net/oic/src/port/mynewt/adaptor.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/oic/src/port/mynewt/adaptor.c 
b/net/oic/src/port/mynewt/adaptor.c
index 23e0e70..24b29b7 100644
--- a/net/oic/src/port/mynewt/adaptor.c
+++ b/net/oic/src/port/mynewt/adaptor.c
@@ -172,21 +172,25 @@ oc_connectivity_shutdown(void)
 int
 oc_connectivity_init(void)
 {
-    int rc = -1;
+    int rc;
     int i;
     const struct oc_transport *ot;
 
     oc_conn_init();
+
     for (i = 0; i < OC_TRANSPORT_MAX; i++) {
         if (!oc_transports[i]) {
             continue;
         }
+
         ot = oc_transports[i];
-        if (ot->ot_init() == 0) {
-            rc = 0;
+        rc = ot->ot_init();
+        if (rc != 0) {
+            return -1;
         }
     }
-    return rc;
+
+    return 0;
 }
 
 void

Reply via email to