From 073af41b7960d5c31fe72b5511552aea7ead1694 Mon Sep 17 00:00:00 2001 From: xionglei6 Date: Mon, 21 Feb 2022 21:13:11 +0800 Subject: [PATCH] fix: code ReviewBot Signed-off-by: xionglei6 --- src/appspawn_server.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp index e0a0a150..7b6b38c5 100755 --- a/src/appspawn_server.cpp +++ b/src/appspawn_server.cpp @@ -58,6 +58,7 @@ constexpr int32_t MAX_LEN_SHORT_NAME = 16; constexpr int32_t WAIT_DELAY_US = 100 * 1000; // 100ms constexpr int32_t GID_USER_DATA_RW = 1008; constexpr int32_t MAX_GIDS = 64; +constexpr int32_t UID_BASE = 200000; constexpr std::string_view BUNDLE_NAME_MEDIA_LIBRARY("com.ohos.medialibrary.MediaLibraryDataA"); constexpr std::string_view BUNDLE_NAME_SCANNER("com.ohos.medialibrary.MediaScannerAbilityA"); @@ -413,7 +414,7 @@ int32_t AppSpawnServer::DoAppSandboxMountOnce(const std::string originPath, cons int32_t AppSpawnServer::DoAppSandboxMount(const ClientSocket::AppProperty *appProperty, std::string rootPath) { - std::string currentUserId = std::to_string(appProperty->uid / 200000); + std::string currentUserId = std::to_string(appProperty->uid / UID_BASE); std::string oriInstallPath = "/data/app/el1/bundle/public/"; std::string oriDataPath = "/data/app/el2/" + currentUserId + "/base/"; std::string oriDatabasePath = "/data/app/el2/" + currentUserId + "/database/"; @@ -479,7 +480,7 @@ int32_t AppSpawnServer::DoAppSandboxMount(const ClientSocket::AppProperty *appPr int32_t AppSpawnServer::DoAppSandboxMountCustomized(const ClientSocket::AppProperty *appProperty, std::string rootPath) { std::string bundleName = appProperty->bundleName; - std::string currentUserId = std::to_string(appProperty->uid / 200000); + std::string currentUserId = std::to_string(appProperty->uid / UID_BASE); // account_0/applications/ dir can still access other packages' data now for compatibility purpose std::string oriapplicationsPath = "/data/app/el1/bundle/public/"; -- Gitee