Modify virtual root 2.2_release submit/tizen_2.2/20130716.173558 submit/tizen_2.2/20130717.053234
authorHyunbin Lee <hyunbin.lee@samsung.com>
Mon, 15 Jul 2013 05:51:58 +0000 (14:51 +0900)
committerHyunbin Lee <hyunbin.lee@samsung.com>
Mon, 15 Jul 2013 05:51:58 +0000 (14:51 +0900)
Change-Id: I4add81f61f422238602c5d66fef4666f856c68ca
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
osp-env-config.c

index 04ed8f0..48f0a01 100644 (file)
@@ -30,6 +30,7 @@
 #include <limits.h>
 #include <sys/prctl.h>
 #include <sys/vfs.h>
+#include <fcntl.h>
 
 #include <dlog.h>
 #include <vconf.h>
@@ -752,8 +753,26 @@ do_pre_exec(const char* package_name, const char* bin_path)
        if (access(virtual_root_file, F_OK) == 0)
        {
                LOGI("This is virtual root application.");
+               int fd = open(virtual_root_file, O_RDONLY);
+               if (fd < 0)
+               {
+                       LOGE("failed to open %s, errno: %d (%s)", virtual_root_file, errno, strerror(errno));
+                       goto ERROR;
+               }
+
+               char user_path[PATH_MAX] = { 0, };
+               int read_bytes = read(fd, user_path, PATH_MAX);
+               if (read_bytes < 0)
+               {
+                       LOGE("failed to read %s, errno: %d (%s)", virtual_root_file, errno, strerror(errno));
+                       close(fd);
+                       goto ERROR;
+               }
+               close(fd);
+
                char virtual_root_path[PATH_MAX] = { 0, };
-               sprintf(virtual_root_path, "%s/virtual-root", app_rootpath);
+               sprintf(virtual_root_path, "%s/data/%s", app_rootpath, user_path);
+
                int res = do_virtual_root(virtual_root_path, package_id);
                free(app_rootpath);
                return res;