mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
检视问题修改
Signed-off-by: zhangyuhang72 <zhangyuhang72@huawei.com> Change-Id: Ia383abaa39fff292cd56e3ed804ebb3eeeb9fcb0
This commit is contained in:
@@ -79,6 +79,7 @@ NativeChildProcess_Args NativeArgsChildProcess::ParseToNativeArgs(const std::str
|
||||
}
|
||||
if (strcpy_s(args.entryParams, entryParams.size() + 1, entryParams.c_str()) != ERR_OK) {
|
||||
delete[] args.entryParams;
|
||||
args.entryParams = nullptr;
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "strcpy_s failed.");
|
||||
return args;
|
||||
}
|
||||
@@ -98,6 +99,7 @@ NativeChildProcess_Args NativeArgsChildProcess::ParseToNativeArgs(const std::str
|
||||
delete[] node->fdName;
|
||||
node->fdName = nullptr;
|
||||
delete node;
|
||||
node = nullptr;
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "strcpy_s failed.");
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ void JsServiceExtension::ListenWMS()
|
||||
return;
|
||||
}
|
||||
|
||||
auto saStatusChangeListener_ =
|
||||
saStatusChangeListener_ =
|
||||
sptr<SystemAbilityStatusChangeListener>::MakeSptr(displayListener_, context->GetToken());
|
||||
if (saStatusChangeListener_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "create status change listener failed");
|
||||
|
||||
@@ -41,7 +41,7 @@ const std::map<ChildProcessManagerErrorCode, Ability_NativeChildProcess_ErrCode>
|
||||
{ ChildProcessManagerErrorCode::ERR_MAX_CHILD_PROCESSES, NCP_ERR_MAX_CHILD_PROCESSES_REACHED },
|
||||
{ ChildProcessManagerErrorCode::ERR_LIB_LOADING_FAILED, NCP_ERR_LIB_LOADING_FAILED },
|
||||
{ ChildProcessManagerErrorCode::ERR_CONNECTION_FAILED, NCP_ERR_CONNECTION_FAILED },
|
||||
{ ChildProcessManagerErrorCode::ERR_MULTI_PROCESS_MODEL_DISABLED_NEW, NCP_ERR_NOT_SUPPORTED },
|
||||
{ ChildProcessManagerErrorCode::ERR_MULTI_PROCESS_MODEL_DISABLED_NEW, NCP_ERR_MULTI_PROCESS_DISABLED },
|
||||
};
|
||||
|
||||
Ability_NativeChildProcess_ErrCode CvtChildProcessManagerErrCode(ChildProcessManagerErrorCode cpmErr)
|
||||
@@ -125,6 +125,10 @@ Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcess(const char
|
||||
std::map<std::string, int32_t> fds;
|
||||
NativeChildProcess_Fd* cur = args.fdList.head;
|
||||
while (cur != nullptr) {
|
||||
if (!cur->fdName) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "fdName null");
|
||||
return NCP_ERR_INVALID_PARAM;
|
||||
}
|
||||
std::string key(cur->fdName);
|
||||
if (key.size() > MAX_KEY_SIZE) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "fd name too long");
|
||||
@@ -143,10 +147,8 @@ Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcess(const char
|
||||
std::string entryParams(args.entryParams);
|
||||
childArgs.entryParams = entryParams;
|
||||
}
|
||||
|
||||
AppExecFwk::ChildProcessOptions childProcessOptions;
|
||||
childProcessOptions.isolationMode = options.isolationMode == NCP_ISOLATION_MODE_ISOLATED;
|
||||
|
||||
int32_t childProcessType = AppExecFwk::CHILD_PROCESS_TYPE_NATIVE_ARGS;
|
||||
|
||||
ChildProcessManager &mgr = ChildProcessManager::GetInstance();
|
||||
@@ -154,6 +156,5 @@ Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcess(const char
|
||||
if (cpmErr != ChildProcessManagerErrorCode::ERR_OK) {
|
||||
return CvtChildProcessManagerErrCode(cpmErr);
|
||||
}
|
||||
|
||||
return NCP_NO_ERROR;
|
||||
}
|
||||
@@ -6708,9 +6708,9 @@ int32_t AppMgrServiceInner::StartChildProcessPreCheck(pid_t callingPid, int32_t
|
||||
CHECK_POINTER_AND_RETURN_VALUE(hostRecord, ERR_NULL_OBJECT);
|
||||
auto &appUtils = AAFwk::AppUtils::GetInstance();
|
||||
if (!appUtils.IsMultiProcessModel()) {
|
||||
bool checkWhiteList = childProcessType == CHILD_PROCESS_TYPE_NATIVE_ARGS ||
|
||||
bool checkAllowList = childProcessType == CHILD_PROCESS_TYPE_NATIVE_ARGS ||
|
||||
childProcessType == CHILD_PROCESS_TYPE_NATIVE;
|
||||
if (!checkWhiteList || !appUtils.IsAllowNativeChildProcess(hostRecord->GetAppIdentifier())) {
|
||||
if (!checkAllowList || !appUtils.IsAllowNativeChildProcess(hostRecord->GetAppIdentifier())) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "not support child process.");
|
||||
return AAFwk::ERR_NOT_SUPPORT_CHILD_PROCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user