X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-export.c;h=cabb485825e2a06782f0c8f98737a904345ea33c;hb=42099d3e2bd791f64c75ce333a71a42d8c053698;hp=3afd8c14597fb40660228665c9da9fdfb81a6327;hpb=de0527f7cf5b4a4278698ab034a332cf75723300;p=src%2Fapp-framework-binder.git diff --git a/src/afb-export.c b/src/afb-export.c index 3afd8c14..cabb4858 100644 --- a/src/afb-export.c +++ b/src/afb-export.c @@ -229,6 +229,7 @@ static struct json_object *make_settings(struct afb_export *export) struct json_object *result; struct json_object *obj; struct afb_export *iter; + char *path; /* clone the globals */ if (json_object_object_get_ex(configuration, "*", &obj)) @@ -242,8 +243,11 @@ static struct json_object *make_settings(struct afb_export *export) /* add library path */ for (iter = export ; iter && !iter->path ; iter = iter->creator); - if (iter) - json_object_object_add(result, "binding-path", json_object_new_string(iter->path)); + if (iter) { + path = realpath(iter->path, NULL); + json_object_object_add(result, "binding-path", json_object_new_string(path)); + free(path); + } export->settings = result; return result; @@ -270,7 +274,7 @@ static void vverbose_cb(struct afb_api_x3 *closure, int level, const char *file, if (!fmt || vasprintf(&p, fmt, args) < 0) vverbose(level, file, line, function, fmt, args); else { - verbose(level, file, line, function, "[API %s] %s", export->api.apiname, p); + verbose(level, file, line, function, (verbose_is_colorized() == 0 ? "[API %s] %s" : COLOR_API "[API %s]" COLOR_DEFAULT " %s"), export->api.apiname, p); free(p); } } @@ -348,6 +352,11 @@ static int require_api_cb(struct afb_api_x3 *closure, const char *name, int init int rc, rc2; char *iter, *end, save; + /* emit a warning about unexpected require in preinit */ + if (export->state == Api_State_Pre_Init) + WARNING("[API %s] requiring apis in pre-init may lead to unexpected result (requires%s: %s)", + export->api.apiname, initialized ? " initialized" : "", name); + /* scan the names in a local copy */ rc = 0; iter = strdupa(name); @@ -1163,7 +1172,7 @@ static void listener_of_events(void *closure, const char *event, int eventid, st /* search the handler */ handler = export->event_handlers; while (handler) { - if (fnmatch(handler->pattern, event, 0)) { + if (!fnmatch(handler->pattern, event, 0)) { if (!(export->hooksvc & afb_hook_flag_api_on_event_handler)) handler->callback(handler->closure, event, object, to_api_x3(export)); else {