afb-apiset: Try to initialize all APIs 53/15353/3
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 12 Jul 2018 15:22:37 +0000 (17:22 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 13 Jul 2018 10:19:11 +0000 (12:19 +0200)
Don't stop on the first error when initializing apis.
Record the error and return it at the end.

Change-Id: I1f0f50ff4e527ca5bf0e78904fccddafe54ba5f2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-apiset.c

index af5a865..0eb64a5 100644 (file)
@@ -858,20 +858,21 @@ int afb_apiset_start_service(struct afb_apiset *set, const char *name, int share
  */
 int afb_apiset_start_all_services(struct afb_apiset *set, int share_session)
 {
-       int rc;
+       int rc, ret;
        int i;
 
+       ret = 0;
        while (set) {
                i = 0;
                while (i < set->apis.count) {
                        rc = start_api(set->apis.apis[i], share_session, 1);
                        if (rc < 0)
-                               return rc;
+                               ret = rc;
                        i++;
                }
                set = set->subset;
        }
-       return 0;
+       return ret;
 }
 
 /**