#include <limits.h>
#include <sys/prctl.h>
#include <sys/vfs.h>
+#include <fcntl.h>
#include <dlog.h>
#include <vconf.h>
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;