X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-so.c;h=bee5fe807c5bd66bb2252f63c624c735c4a721bc;hb=95c29ef579d6320a721f96d7146efd10f74a201b;hp=b5da60f5b19484573fd87e33ffc9d600a5b06881;hpb=e9040472b72ff699964d89dda03ef07ce72b487b;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-so.c b/src/afb-api-so.c index b5da60f5..bee5fe80 100644 --- a/src/afb-api-so.c +++ b/src/afb-api-so.c @@ -45,26 +45,29 @@ static int load_binding(const char *path, int force, struct afb_apiset *apiset) goto error; } - /* retrieves the register function */ + /* try the version 2 */ rc = afb_api_so_v2_add(path, handle, apiset); if (rc < 0) { /* error when loading a valid v2 binding */ goto error2; } + if (rc) + return 0; /* yes version 2 */ + + /* try the version 1 */ rc = afb_api_so_v1_add(path, handle, apiset); if (rc < 0) { /* error when loading a valid v1 binding */ goto error2; } - if (rc == 0) { - /* not a v1 binding */ - if (force) - ERROR("binding [%s] is not an AFB binding", path); - else - INFO("binding [%s] is not an AFB binding", path); - goto error2; - } - return 0; + if (rc) + return 0; /* yes version 1 */ + + /* not a valid binding */ + if (force) + ERROR("binding [%s] is not an AFB binding", path); + else + INFO("binding [%s] is not an AFB binding", path); error2: dlclose(handle);