Fix: use of GetBindingDirPath without dynapi 53/15453/2 sandbox/claneys/signalComposerFix
authorRomain Forlot <romain.forlot@iot.bzh>
Thu, 19 Jul 2018 09:56:36 +0000 (11:56 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Fri, 20 Jul 2018 09:53:30 +0000 (11:53 +0200)
For classic binding < 3 without dynapi this fix the error
at compile time about conflicting type for this function.
This worked on eel and previous version because 'struct dynapi'
was declared and available for version 2 but now since binder
is in V3 then it isn't the case so function signature is not
valid anymore.

Change-Id: I135a723d21d70b8c54f4cab1c534210757318ed0
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
filescan-utils.c
filescan-utils.h

index 6c443ea..05e13f9 100644 (file)
@@ -146,14 +146,18 @@ const char* GetBinderName()
     return binderName;
 }
 
-char* GetBindingDirPath(struct afb_dynapi* dynapi)
+#if(AFB_BINDING_VERSION == 0 && defined(AFB_BINDING_WANT_DYNAPI))
+char *GetBindingDirPath(struct afb_dynapi *dynapi)
+#else
+char *GetBindingDirPath()
+#endif
 {
     // A file description should not be greater than 999.999.999
     char fd_link[CONTROL_MAXPATH_LEN];
     char retdir[CONTROL_MAXPATH_LEN];
     ssize_t len;
 
-#if((AFB_BINDING_VERSION == 0 || AFB_BINDING_VERSION == 3) && defined(AFB_BINDING_WANT_DYNAPI))
+#if(AFB_BINDING_VERSION == 0 && defined(AFB_BINDING_WANT_DYNAPI))
     if (!dynapi)
         return NULL;
     sprintf(fd_link, "/proc/self/fd/%d", afb_dynapi_rootdir_get_fd(dynapi));
index bf8fb53..64ecfb9 100644 (file)
@@ -86,7 +86,11 @@ extern json_object* ScanForConfig (const char* searchPath, CtlScanDirModeT mode,
  *
  * @return char* string representing the path to binding root directory.
  */
+#if(AFB_BINDING_VERSION == 0 && defined(AFB_BINDING_WANT_DYNAPI))
 extern char *GetBindingDirPath(struct afb_dynapi *dynapi);
+#else
+extern char *GetBindingDirPath();
+#endif
 
 /**
  * @brief Get the environment directory colon separated path list. This take the