summaryrefslogtreecommitdiffstats
path: root/filescan-utils.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-09 12:56:47 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-05-09 13:01:53 +0200
commitaca86d46417a1afb198c927aea79e50a96925580 (patch)
treea9f980a9afb411e4b5385bd00d7b5412e1386608 /filescan-utils.c
parentad95795ba872303d24cf2302b039a9068d5b83b7 (diff)
Adapt function to dynamic API
A dynamic API being dynamic, you need to pass as parameter on behalf of which API you want to act. If you are using classic v2 API then just pass a NULL pointer value. Change-Id: I9ac6b606ff25c63a05a647e418a7c2bcc4b2a7fe Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'filescan-utils.c')
-rw-r--r--filescan-utils.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/filescan-utils.c b/filescan-utils.c
index d590aab..60905a6 100644
--- a/filescan-utils.c
+++ b/filescan-utils.c
@@ -130,19 +130,21 @@ const char *GetBinderName() {
return binderName;
}
-#ifndef USE_API_DYN
-char *GetBindingDirPath()
+char *GetBindingDirPath(struct afb_dynapi *dynapi)
{
// A file description should not be greater than 999.999.999
char fd_link[CONTROL_MAXPATH_LEN];
char retdir[CONTROL_MAXPATH_LEN];
- sprintf(fd_link, "/proc/self/fd/%d", afb_daemon_rootdir_get_fd());
-
ssize_t len;
+
+ if(dynapi)
+ sprintf(fd_link, "/proc/self/fd/%d", afb_dynapi_rootdir_get_fd(dynapi));
+ else
+ sprintf(fd_link, "/proc/self/fd/%d", afb_daemon_rootdir_get_fd_v2());
+
if((len = readlink(fd_link, retdir, sizeof(retdir)-1)) == -1)
{
perror("lstat");
- AFB_ERROR("Error reading stat of link: %s", fd_link);
strncpy(retdir, "/tmp", 4);
}
else
@@ -152,4 +154,3 @@ char *GetBindingDirPath()
return strndup(retdir, sizeof(retdir));
}
-#endif