diff --git a/common/appspawn_server.c b/common/appspawn_server.c index 38245327..a9e771b9 100644 --- a/common/appspawn_server.c +++ b/common/appspawn_server.c @@ -89,11 +89,6 @@ int DoStartApp(struct AppSpawnContent *content, AppSpawnClient *client, char *lo content->handleInternetPermission(client); } - if (content->setEnvInfo) { - ret = content->setEnvInfo(content, client); - APPSPAWN_CHECK(ret == 0, NotifyResToParent(content, client, ret); return ret, "Failed to setEnvInfo"); - } - if (content->setAppSandbox) { ret = content->setAppSandbox(content, client); APPSPAWN_CHECK(ret == 0, NotifyResToParent(content, client, ret); return ret, "Failed to set app sandbox"); @@ -155,8 +150,7 @@ static int AppSpawnChild(void *arg) if (content->setProcessName) { ret = content->setProcessName(content, client, content->longProcName, content->longProcNameLen); - APPSPAWN_CHECK(ret == 0, NotifyResToParent(content, client, ret); - return ret, "Failed to set setProcessName"); + APPSPAWN_CHECK(ret == 0, NotifyResToParent(content, client, ret); return ret, "Failed to set setProcessName"); } #ifdef OHOS_DEBUG @@ -170,10 +164,12 @@ static int AppSpawnChild(void *arg) if (content->setAppAccessToken != NULL) { ret = content->setAppAccessToken(content, client); - if (ret != 0) { - APPSPAWN_LOGE("AppSpawnChild, set app token id failed"); - return -1; - } + APPSPAWN_CHECK(ret == 0, return -1, "AppSpawnChild, set app token id failed"); + } + + if (content->setEnvInfo) { + ret = content->setEnvInfo(content, client); + APPSPAWN_CHECK(ret == 0, NotifyResToParent(content, client, ret); return ret, "Failed to setEnvInfo"); } if ((content->getWrapBundleNameValue != NULL && content->getWrapBundleNameValue(content, client) == 0) || diff --git a/modules/common/appspawn_common.c b/modules/common/appspawn_common.c index 6edf9d56..43682bae 100755 --- a/modules/common/appspawn_common.c +++ b/modules/common/appspawn_common.c @@ -335,6 +335,9 @@ static int SpawnInitSpawningEnv(AppSpawnMgr *content, AppSpawningCtx *property) ret = SetAppAccessToken(content, property); APPSPAWN_CHECK_ONLY_EXPER(ret == 0, return ret); + + ret = SetEnvInfo(content, property); + APPSPAWN_CHECK_ONLY_EXPER(ret == 0, return ret); return 0; } @@ -378,9 +381,6 @@ static int SpawnSetProperties(AppSpawnMgr *content, AppSpawningCtx *property) ret = SetSelinuxCon(content, property) == -1; APPSPAWN_CHECK_ONLY_EXPER(ret == 0, return ret); - ret = SetEnvInfo(content, property); - APPSPAWN_CHECK_ONLY_EXPER(ret == 0, return ret); - ret = WaitForDebugger(property); APPSPAWN_CHECK_ONLY_EXPER(ret == 0, return ret);