diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-05-22 16:37:28 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-05-22 17:01:05 +0200 |
commit | 95c29ef579d6320a721f96d7146efd10f74a201b (patch) | |
tree | 2460427281fe724014033774a7786c857332cfb4 /src/afb-api-so.c | |
parent | e9040472b72ff699964d89dda03ef07ce72b487b (diff) |
Bindings V2: Remove explicit references to daemon/service
Usage shown that managing daemon interface and service
interface wasn't obvious. This evolution hides the complexity
by setting up an internal hidden variable.
Change-Id: I667b1ee4e3a7b5ad29d712ee20ad5dd1878b97f3
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-so.c')
-rw-r--r-- | src/afb-api-so.c | 23 |
1 files changed, 13 insertions, 10 deletions
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); |