codecheck修复+挂载修复

Signed-off-by: 王达 <wangda20@huawei.com>
This commit is contained in:
王达 2024-08-20 12:41:57 +08:00
parent d4c348f19a
commit 516db4b345
4 changed files with 17 additions and 13 deletions

View File

@ -3,6 +3,7 @@
"top-sandbox-switch": "ON",
"app-base": [{
"sandbox-ns-flags" : [ "net" ],
"sandbox-root" : "/mnt/sandbox/<PackageName>",
"mount-paths" : [{
"src-path" : "/dev",
"sandbox-path" : "/dev",
@ -94,8 +95,8 @@
"sandbox-flags" : [ "bind", "rec" ],
"check-action-status": "false"
}, {
"src-path" : "/data/app/el1/bundle/public/",
"sandbox-path" : "/data/app/el1/bundle/public/",
"src-path" : "/data/app/el1/bundle/public/<PackageName>",
"sandbox-path" : "/data/storage/el1/bundle",
"sandbox-flags" : [ "bind", "rec" ],
"check-action-status": "false"
}],
@ -117,6 +118,12 @@
"check-action-status": "false"
}]
}],
"app-resources" : [{
"sandbox-root" : "/mnt/sandbox/<PackageName>",
"mount-paths" : [],
"flag-point" : [],
"symbol-links" : []
}]
}]
}

View File

@ -488,11 +488,8 @@ string SandboxUtils::ConvertToRealPath(const AppSpawningCtx *appProperty, std::s
path = replace_all(path, g_packageNameIndex, bundleNameWithIndex);
}
const std::string bundleName = CheckAppMsgFlagsSet(appProperty, APP_FLAGS_ISOLATED_SANDBOX_TYPE) ? "isolated/"
: "" + std::string(info->bundleName);
if (path.find(g_packageName) != std::string::npos) {
path = replace_all(path, g_packageName, bundleName.c_str());
path = replace_all(path, g_packageName, info->bundleName);
}
if (path.find(g_userId) != std::string::npos) {

View File

@ -991,10 +991,10 @@ APPSPAWN_STATIC void AppSpawnArgSet(RunMode mode, AppSpawnStartArg *arg)
return;
}
APPSPAWN_STATIC void AppSpawnStartServiceEnd(pid_t nwebSpawnPid, pid_t NativeSpawnPid)
APPSPAWN_STATIC void AppSpawnStartServiceEnd(pid_t nwebSpawnPid, pid_t nativeSpawnPid)
{
AddSpawnedProcess(nwebSpawnPid, NWEBSPAWN_SERVER_NAME);
AddSpawnedProcess(NativeSpawnPid, NATIVESPAWN_SERVER_NAME);
AddSpawnedProcess(nativeSpawnPid, NATIVESPAWN_SERVER_NAME);
SetParameter("bootevent.appspawn.started", "true");
}
@ -1002,7 +1002,7 @@ AppSpawnContent *StartSpawnService(const AppSpawnStartArg *startArg, uint32_t ar
{
APPSPAWN_CHECK(startArg != NULL && argv != NULL, return NULL, "Invalid start arg");
pid_t pid = 0;
pid_t NativeSpawnPid = 0;
pid_t nativeSpawnPid = 0;
AppSpawnStartArg *arg = (AppSpawnStartArg *)startArg;
APPSPAWN_LOGV("Start appspawn argvSize %{public}d mode %{public}d service %{public}s",
argvSize, arg->mode, arg->serviceName);
@ -1011,8 +1011,8 @@ AppSpawnContent *StartSpawnService(const AppSpawnStartArg *startArg, uint32_t ar
if (pid == 0) {
AppSpawnArgSet(MODE_FOR_NWEB_SPAWN, arg);
} else {
NativeSpawnPid = NativeSpawnLaunch();
if (NativeSpawnPid == 0) {
nativeSpawnPid = NativeSpawnLaunch();
if (nativeSpawnPid == 0) {
AppSpawnArgSet(MODE_FOR_NATIVE_SPAWN, arg);
}
}
@ -1046,7 +1046,7 @@ AppSpawnContent *StartSpawnService(const AppSpawnStartArg *startArg, uint32_t ar
#endif
AddAppSpawnHook(STAGE_CHILD_PRE_RUN, HOOK_PRIO_LOWEST, AppSpawnClearEnv);
if (arg->mode == MODE_FOR_APP_SPAWN) {
AppSpawnStartServiceEnd(pid, NativeSpawnPid);
AppSpawnStartServiceEnd(pid, nativeSpawnPid);
}
return content;
}

View File

@ -115,7 +115,7 @@ int AppSpawnTestCommander::ProcessArgs(int argc, char *const argv[])
if (strcmp(argv[i], "nwebspawn") == 0) {
appSpawn_ = 0;
} else if (strcmp(argv[i], "nativespawn") == 0) {
appSpawn_ = 2;
appSpawn_ = 2; // 2 is nwebspawn
} else {
appSpawn_ = 1;
}