Fix getting root path at extractor module 19/236819/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 22 Jun 2020 08:38:40 +0000 (17:38 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 22 Jun 2020 08:38:40 +0000 (17:38 +0900)
Use AMD_AIT_ROOT_PATH instead.

Change-Id: I51ac08abce979d343975573caa8bddd71e0892e6
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
modules/extractor/src/amd_extractor.c

index 8f576011b59db078fa538f9c8bbbad61093d4e12..28c4373bbd01d739c54a4999121ef23d145a1556 100644 (file)
@@ -37,40 +37,16 @@ typedef char **(_extractor_mountable)(const amd_appinfo_h ai);
 
 static GHashTable *mount_point_hash;
 
-static const char *__get_app_root_path(const amd_appinfo_h ai)
-{
-       const char *path_app_root;
-       const char *global;
-       const char *preload;
-
-       preload = amd_appinfo_get_value(ai, AMD_AIT_PRELOAD);
-       global = amd_appinfo_get_value(ai, AMD_AIT_GLOBAL);
-       if (global && strcmp(global, "true") == 0) {
-               if (preload && strcmp(preload, "true") == 0)
-                       path_app_root = PATH_GLOBAL_APP_RO_ROOT;
-               else
-                       path_app_root = PATH_GLOBAL_APP_RW_ROOT;
-       } else {
-               path_app_root = PATH_APP_ROOT;
-       }
-
-       return path_app_root;
-}
-
 static char **__extractor_mountable_get_tep_paths(const amd_appinfo_h ai)
 {
        char tep_path[PATH_MAX];
        char **mnt_path;
-       const char *pkgid;
        const char *tep_name;
+       const char *root_path;
 
        if (ai == NULL)
                return NULL;
 
-       pkgid = amd_appinfo_get_value(ai, AMD_AIT_PKGID);
-       if (pkgid == NULL)
-               return NULL;
-
        tep_name = amd_appinfo_get_value(ai, AMD_AIT_TEP);
        if (tep_name == NULL)
                return NULL;
@@ -87,8 +63,9 @@ static char **__extractor_mountable_get_tep_paths(const amd_appinfo_h ai)
                free(mnt_path);
                return NULL;
        }
-       snprintf(tep_path, PATH_MAX, "%s/%s/tep/mount",
-                       __get_app_root_path(ai), pkgid);
+
+       root_path = amd_appinfo_get_value(ai, AMD_AIT_ROOT_PATH);
+       snprintf(tep_path, PATH_MAX, "%s/tep/mount", root_path);
        mnt_path[0] = strdup(tep_path);
        if (mnt_path[0] == NULL) {
                _E("Out of memory");
@@ -104,16 +81,12 @@ static char **__extractor_mountable_get_tpk_paths(const amd_appinfo_h ai)
 {
        char mount_point[PATH_MAX];
        char **mnt_path;
-       const char *pkgid;
        const char *tpk;
+       const char *root_path;
 
        if (ai == NULL)
                return NULL;
 
-       pkgid = amd_appinfo_get_value(ai, AMD_AIT_PKGID);
-       if (pkgid == NULL)
-               return NULL;
-
        tpk = amd_appinfo_get_value(ai, AMD_AIT_MOUNTABLE_PKG);
        if (tpk == NULL)
                return NULL;
@@ -130,8 +103,8 @@ static char **__extractor_mountable_get_tpk_paths(const amd_appinfo_h ai)
                free(mnt_path);
                return NULL;
        }
-       snprintf(mount_point, PATH_MAX, "%s/%s/.pkg",
-                               __get_app_root_path(ai), pkgid);
+       root_path = amd_appinfo_get_value(ai, AMD_AIT_ROOT_PATH);
+       snprintf(mount_point, PATH_MAX, "%s/.pkg", root_path);
        mnt_path[0] = strdup(mount_point);
        if (mnt_path[0] == NULL) {
                free(mnt_path[1]);