From: Sangyoon Jang Date: Fri, 11 Jun 2021 05:07:02 +0000 (+0900) Subject: Fix mount res dir X-Git-Tag: submit/tizen/20210623.014632~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77a24e6676fb1e89e515643e65ad1ce4de39b5d6;p=platform%2Fcore%2Fappfw%2Flaunchpad.git Fix mount res dir upperdir, workdir is not necessary for read-only mount. Change-Id: I8849b7601541d415e65ffce025f0a7f2a505792e Signed-off-by: Sangyoon Jang --- diff --git a/src/lib/common/src/launchpad_common.c b/src/lib/common/src/launchpad_common.c index 7c4ab6f1..61cb98cd 100644 --- a/src/lib/common/src/launchpad_common.c +++ b/src/lib/common/src/launchpad_common.c @@ -1494,27 +1494,23 @@ void _print_hwc_log(const char *format, ...) } static int __get_mount_opt(const char *srcs[], size_t srcs_len, - const char *dest, const char *workdir, char *opt, size_t opt_len) + const char *dest, char *opt, size_t opt_len) { int i; char buf[PATH_MAX]; int ret; - snprintf(buf, sizeof(buf), "%s", "lowerdir="); - snprintf(opt, opt_len, "%s", buf); + /* read-only mount (without upperdir,workdir) needs at least 2 lowerdir, + * so we set dest itself as lowerdir. + */ + snprintf(opt, opt_len, "lowerdir=%s", dest); for (i = 0; i < srcs_len; i++) { - snprintf(buf, sizeof(buf), "%s%s", opt, srcs[i]); - ret = snprintf(opt, opt_len, "%s:", buf); + ret = snprintf(buf, sizeof(buf), "%s:%s", opt, srcs[i]); if (ret < 0) { _E("source directory string size is too large"); return -1; } - } - ret = snprintf(opt, opt_len, "%s,upperdir=%s,workdir=%s", buf, dest, - workdir); - if (ret < 0) { - _E("source directory string size is too large"); - return -1; + snprintf(opt, opt_len, "%s", buf); } _D("mount opt: %s", opt); @@ -1522,13 +1518,12 @@ static int __get_mount_opt(const char *srcs[], size_t srcs_len, return 0; } -static int __mount_dir(const char *srcs[], size_t srcs_len, const char *dest, - const char *workdir) +static int __mount_dir(const char *srcs[], size_t srcs_len, const char *dest) { int ret; char opt[PATH_MAX]; - ret = __get_mount_opt(srcs, srcs_len, dest, workdir, opt, sizeof(opt)); + ret = __get_mount_opt(srcs, srcs_len, dest, opt, sizeof(opt)); if (ret < 0) { _E("Failed to get mount option"); return -1; @@ -1548,14 +1543,11 @@ int _mount_res_dir(const char *root_path, bundle *kb) const char **val; int len; char dest[PATH_MAX]; - char workdir[PATH_MAX]; val = bundle_get_str_array(kb, AUL_K_MOUNT_GLOBAL_RES_DIR, &len); if (val) { snprintf(dest, sizeof(dest), "%s/res/mount/global", root_path); - snprintf(workdir, sizeof(workdir), "%s/res/mount/work", - root_path); - __mount_dir(val, len, dest, workdir); + __mount_dir(val, len, dest); } else if (get_last_result() != BUNDLE_ERROR_KEY_NOT_AVAILABLE) { _E("invalid mount info"); return -1; @@ -1564,9 +1556,7 @@ int _mount_res_dir(const char *root_path, bundle *kb) val = bundle_get_str_array(kb, AUL_K_MOUNT_ALLOWED_RES_DIR, &len); if (val) { snprintf(dest, sizeof(dest), "%s/res/mount/allowed", root_path); - snprintf(workdir, sizeof(workdir), "%s/res/mount/work", - root_path); - __mount_dir(val, len, dest, workdir); + __mount_dir(val, len, dest); } else if (get_last_result() != BUNDLE_ERROR_KEY_NOT_AVAILABLE) { _E("invalid mount info"); return -1;