From 7138f54926ebfb286c3c77d126d3dc0b30c81b72 Mon Sep 17 00:00:00 2001 From: chennuo Date: Mon, 18 Aug 2025 10:32:13 +0800 Subject: [PATCH] fix bugs:nosharefsDocsDir Signed-off-by: chennuo --- modules/sandbox/normal/sandbox_shared_mount.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/sandbox/normal/sandbox_shared_mount.cpp b/modules/sandbox/normal/sandbox_shared_mount.cpp index e168faa5..860af6a2 100644 --- a/modules/sandbox/normal/sandbox_shared_mount.cpp +++ b/modules/sandbox/normal/sandbox_shared_mount.cpp @@ -303,8 +303,15 @@ static int MountWithOther(const AppSpawningCtx *property, const AppDacInfo *info return APPSPAWN_ERROR_UTILS_MEM_FAIL; } #ifdef APPSPAWN_SUPPORT_NOSHAREFS + char nosharefsDocsDir[PATH_MAX_LEN] = {0}; + ret = snprintf_s(nosharefsDocsDir, PATH_MAX_LEN, PATH_MAX_LEN - 1, "/mnt/user/%u/nosharefs/docs", + info->uid / UID_BASE); + if (ret <= 0) { + APPSPAWN_LOGE("snprintf nosharefsDocsDir failed, errno %{public}d", errno); + return APPSPAWN_ERROR_UTILS_MEM_FAIL; + } SharedMountArgs arg = { - .srcPath = sharefsDocsDir, + .srcPath = nosharefsDocsDir, .destPath = storageUserPath, .fsType = nullptr, .mountFlags = MS_BIND | MS_REC, -- Gitee