afb-export: Provide the real path of the binding 05/16005/2 5.99.3 flounder/5.99.3 flounder_5.99.3
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 3 Aug 2018 11:00:35 +0000 (13:00 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 8 Aug 2018 14:52:57 +0000 (14:52 +0000)
The path can be a symbolic link. It must be resolved
to be usefull.

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

index 3afd8c1..e679b76 100644 (file)
@@ -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;