summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSemun Lee <sm79.lee@samsung.com>2016-07-25 13:50:58 +0900
committerSemun Lee <sm79.lee@samsung.com>2016-07-25 13:50:58 +0900
commit51b26353ea9015d647bc56b42a2c983e080ed220 (patch)
treef529cb78026df1bd3214164fa9d804990601bd07
parent4e715370a48e77a92ce6d0462fd178b94b2bf959 (diff)
downloadlaunchpad-51b26353ea9015d647bc56b42a2c983e080ed220.tar.gz
launchpad-51b26353ea9015d647bc56b42a2c983e080ed220.tar.bz2
launchpad-51b26353ea9015d647bc56b42a2c983e080ed220.zip
Mount app legacy path as private explicitly
Change-Id: Iba25fb8619d04b235a6bb421a9a9fa2c7f58b695 Signed-off-by: Semun Lee <sm79.lee@samsung.com>
-rw-r--r--src/launchpad_common.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/launchpad_common.c b/src/launchpad_common.c
index a206e63..f6e314f 100644
--- a/src/launchpad_common.c
+++ b/src/launchpad_common.c
@@ -814,6 +814,30 @@ int _close_all_fds(const int except)
return 0;
}
+static int __mount_and_make_private(const char *source, const char *target)
+{
+ int ret;
+
+ ret = mount(NULL, "/", NULL,
+ MS_SLAVE | MS_REC, NULL);
+ if (ret != 0) {
+ _E("failed to set / as slave dir(%d)", ret);
+ return ret;
+ }
+
+ ret = mount(source, target,
+ NULL, MS_BIND, NULL);
+ if (ret != 0) {
+ _E("failed to mount legacy dir(%d): %s to %s",
+ ret, source, target);
+ return ret;
+ }
+
+ _D("end legacy path mount");
+
+ return ret;
+}
+
int _mount_legacy_app_path(const char *app_root_path,
const char *pkgid)
{
@@ -823,6 +847,8 @@ int _mount_legacy_app_path(const char *app_root_path,
char user_app_data_path[PATH_MAX];
char legacy_app_data_path[PATH_MAX];
+ _D("start legacy path mount");
+
char *app_data_paths[5] = {
"data",
"cache",
@@ -841,8 +867,7 @@ int _mount_legacy_app_path(const char *app_root_path,
/* for user private app */
if (!strncmp(app_root_path, user_app_dir, strlen(user_app_dir))) {
- return mount(app_root_path, legacy_app_path,
- NULL, MS_BIND, NULL);
+ return __mount_and_make_private(app_root_path, legacy_app_path);
}
/* for global app */
@@ -855,8 +880,8 @@ int _mount_legacy_app_path(const char *app_root_path,
snprintf(legacy_app_data_path, PATH_MAX, "%s/%s",
legacy_app_path, app_data_paths[i]);
- ret = mount(user_app_data_path, legacy_app_data_path,
- NULL, MS_BIND, NULL);
+ ret = __mount_and_make_private(user_app_data_path,
+ legacy_app_data_path);
if (ret != 0)
return ret;
}