From 35e46b47e3b26798e21d6795bfa70521e457a11f Mon Sep 17 00:00:00 2001 From: Hyunbin Lee Date: Thu, 11 Apr 2013 15:44:57 +0900 Subject: [PATCH] Fix non-sharing problem of trusted directory for OSP compatible application Change-Id: I176100400cd6ea577b5de9843ebcc204b156e357 Signed-off-by: Hyunbin Lee --- osp-env-config.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/osp-env-config.c b/osp-env-config.c index ba389df..9d732e6 100644 --- a/osp-env-config.c +++ b/osp-env-config.c @@ -360,8 +360,10 @@ mount_osp_internal_paths(const char* app_rootpath, const char* pkgid) static int link_osp_share_path(const char* app_rootpath, const char* pkgid) { - char osp_app_share_path[PATH_MAX] = {0, }; - char osp_share_pkgid_path[PATH_MAX] = {0, }; + char osp_app_share_path[PATH_MAX] = { 0, }; + char osp_app_share2_path[PATH_MAX] = { 0, }; + char osp_share_pkgid_path[PATH_MAX] = { 0, }; + char osp_share2_pkgid_path[PATH_MAX] = { 0, }; strncpy(osp_app_share_path, app_rootpath, strlen(app_rootpath)); strncat(osp_app_share_path, "/shared/data", 12); @@ -370,16 +372,32 @@ link_osp_share_path(const char* app_rootpath, const char* pkgid) strncat(osp_share_pkgid_path, "share/", 6); strncat(osp_share_pkgid_path, pkgid, strlen(pkgid)); + strncpy(osp_app_share2_path, app_rootpath, strlen(app_rootpath)); + strncat(osp_app_share2_path, "/shared/trusted", 15); + + strncpy(osp_share2_pkgid_path, _OSP_COMPAT_SHARED_PATH, strlen(_OSP_COMPAT_SHARED_PATH)); + strncat(osp_share2_pkgid_path, "share2/", 7); + strncat(osp_share2_pkgid_path, pkgid, strlen(pkgid)); + unlink(osp_share_pkgid_path); + unlink(osp_share2_pkgid_path); int ret = symlink(osp_app_share_path, osp_share_pkgid_path); - if (ret == -1 && errno != 17) // EEXIST + if (ret == -1 && errno != EEXIST) { LOGE("symlink() failed, src path: %s, dest path: %s, errno: %d (%s)", osp_app_share_path, osp_share_pkgid_path, errno, strerror(errno)); return -1; } + ret = symlink(osp_app_share2_path, osp_share2_pkgid_path); + if (ret == -1 && errno != EEXIST) + { + LOGE("symlink() failed, src path: %s, dest path: %s, errno: %d (%s)", + osp_app_share2_path, osp_share2_pkgid_path, errno, strerror(errno)); + return -1; + } + return 0; } -- 2.7.4