提交 04eabb53 编写于 作者: M Mupceet

fix: dump错误

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 7785b779
......@@ -201,7 +201,10 @@ if (defined(ohos_lite)) {
]
include_dirs = param_include_dirs
defines = [ "_GNU_SOURCE" ]
defines = [
"_GNU_SOURCE",
"INIT_AGENT",
]
if (build_selinux) {
sources += [ "adapter/param_selinux.c" ]
defines += [
......
......@@ -213,6 +213,16 @@ int ReadParamWithCheck(const char *name, uint32_t op, ParamHandle *handle)
*handle = -1;
int ret = CheckParamPermission(&g_paramWorkSpace.securityLabel, name, op);
PARAM_CHECK(ret == 0, return ret, "Forbid to access parameter %s", name);
#ifdef PARAM_SUPPORT_SELINUX
if (ret == DAC_RESULT_PERMISSION) {
const char *label = GetSelinuxContent(name);
if (label != NULL) {
AddWorkSpace(label, 1, PARAM_WORKSPACE_DEF);
} else {
AddWorkSpace(WORKSPACE_NAME_DEF_SELINUX, 1, PARAM_WORKSPACE_DEF);
}
}
#endif
WorkSpace *space = GetWorkSpace(name);
PARAM_CHECK(space != NULL, return PARAM_CODE_INVALID_PARAM, "Invalid workSpace");
ParamTrieNode *node = FindTrieNode(space, name, strlen(name), NULL);
......
......@@ -105,6 +105,7 @@ int InitWorkSpace(WorkSpace *workSpace, int onlyRead, uint32_t spaceSize)
}
workSpace->compareTrieNode = CompareParamTrieNode;
workSpace->allocTrieNode = AllocateParamTrieNode;
workSpace->area = NULL;
int ret = InitWorkSpace_(workSpace, spaceSize, onlyRead);
PARAM_CHECK(ret == 0, return ret, "Failed to init workspace %s", workSpace->fileName);
PARAMSPACE_AREA_INIT_LOCK(workSpace);
......@@ -397,7 +398,7 @@ void SaveIndex(uint32_t *index, uint32_t offset)
ParamTrieNode *FindTrieNode(WorkSpace *workSpace, const char *key, uint32_t keyLen, uint32_t *matchLabel)
{
PARAM_CHECK(workSpace != NULL, return NULL, "Invalid workSpace");
PARAM_CHECK(workSpace != NULL && workSpace->area != NULL, return NULL, "Invalid workSpace");
ParamTrieNode *node = NULL;
PARAMSPACE_AREA_RD_LOCK(workSpace);
node = FindTrieNode_(workSpace, key, keyLen, matchLabel);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册