Remove duplicated dlopen by other platform 79/98279/2 accepted/tizen/common/20161122.192824 accepted/tizen/ivi/20161122.235920 accepted/tizen/mobile/20161122.235713 accepted/tizen/tv/20161122.235756 accepted/tizen/wearable/20161122.235837 submit/tizen/20161122.044017
authorJiyong Min <jiyong.min@samsung.com>
Thu, 17 Nov 2016 01:37:58 +0000 (10:37 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Thu, 17 Nov 2016 02:03:20 +0000 (18:03 -0800)
(Replace hard-coded path to the path which is got at compile)

 - unit test(32bit/64bit): Pass

 [version] 0.3.15

Change-Id: I24c83af86904ada22e36bed96de771e8c7f27969
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
packaging/media-server.spec
src/mediadb-update.c

index 12e683c..7f66d02 100755 (executable)
@@ -86,6 +86,7 @@ export CFLAGS="$CFLAGS -D_USE_MULTI_USER -D_USE_META_UPDATE -D_USE_DEVICED_DBUS"
 %endif
 %endif
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DSYSCONFDIR=\\\"%{_sysconfdir}\\\""
+export CFLAGS+=" -DPATH_LIBDIR=\\\"%{_libdir}\\\""
 rm -rf autom4te.cache
 rm -f aclocal.m4 ltmain.sh
 mkdir -p m4
index d989bbc..0b30a05 100755 (executable)
@@ -45,6 +45,7 @@
 #define PATH_BLOCK                  OBJECT_PATH"/Block"
 #define PATH_BLOCK_MANAGER          PATH_BLOCK"/Manager"
 #define INTERFACE_BLOCK_MANAGER     INTERFACE_NAME".BlockManager"
+#define PATH_PLUGIN_LIB                                PATH_LIBDIR"/libmedia-content-plugin.so"
 
 #define DEVICE_METHOD "GetDeviceList"
 #define DEVICE_USB "scsi"
@@ -251,13 +252,10 @@ static int __check_mmc(void)
        char *insert_stg_id = NULL;
        char *err_msg = NULL;
 
-       funcHandle = dlopen("/usr/lib/libmedia-content-plugin.so", RTLD_LAZY);
+       funcHandle = dlopen(PATH_PLUGIN_LIB, RTLD_LAZY);
        if (funcHandle == NULL) {
-               funcHandle = dlopen("/usr/lib64/libmedia-content-plugin.so", RTLD_LAZY);
-               if (funcHandle == NULL) {
-                       printf("Error when open plug-in\n");
-                       return -1;
-               }
+               printf("Error when open plug-in\n");
+               return -1;
        }
 
        svc_connect                     = dlsym(funcHandle, "connect_db");
@@ -349,13 +347,10 @@ static void __check_media_db(void)
        char *err_msg = NULL;
        int ret = 0;
 
-       funcHandle = dlopen("/usr/lib/libmedia-content-plugin.so", RTLD_LAZY);
+       funcHandle = dlopen(PATH_PLUGIN_LIB, RTLD_LAZY);
        if (funcHandle == NULL) {
-               funcHandle = dlopen("/usr/lib64/libmedia-content-plugin.so", RTLD_LAZY);
-               if (funcHandle == NULL) {
-                       printf("Error when open plug-in\n");
-                       return;
-               }
+               printf("Error when open plug-in\n");
+               return;
        }
 
        svc_connect                     = dlsym(funcHandle, "connect_db");
@@ -391,13 +386,10 @@ static int __get_storage_id(const char *path, char *storage_id, uid_t uid)
                return -1;
        }
 
-       funcHandle = dlopen("/usr/lib/libmedia-content-plugin.so", RTLD_LAZY);
+       funcHandle = dlopen(PATH_PLUGIN_LIB, RTLD_LAZY);
        if (funcHandle == NULL) {
-               funcHandle = dlopen("/usr/lib64/libmedia-content-plugin.so", RTLD_LAZY);
-               if (funcHandle == NULL) {
-                       printf("Error when open plug-in\n");
-                       return -1;
-               }
+               printf("Error when open plug-in\n");
+               return -1;
        }
 
        svc_connect                     = dlsym(funcHandle, "connect_db");