X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-so.c;h=bee5fe807c5bd66bb2252f63c624c735c4a721bc;hb=c6380108964e71f533d8c672bb9c217020a95e8d;hp=4b8f070c32fd6f433022e412edca40e067fc1b89;hpb=a8e971702f23ee67e02b4716ad4159f12cefdca6;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-so.c b/src/afb-api-so.c index 4b8f070c..bee5fe80 100644 --- a/src/afb-api-so.c +++ b/src/afb-api-so.c @@ -16,7 +16,6 @@ */ #define _GNU_SOURCE -#define NO_BINDING_VERBOSE_MACRO #include #include @@ -46,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);