未验证 提交 e086e739 编写于 作者: O openharmony_ci 提交者: Gitee

!1701 FIX:修改编译告警,挑单monthly

Merge pull request !1701 from cheng_jinsong/cherry-pick-1673856143
......@@ -17,6 +17,7 @@ import optparse
import os
import sys
import json
import stat
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, os.pardir, "build"))
......@@ -66,7 +67,9 @@ def fix_para_file(options):
if options.extra:
parse_extra_params(options.extra, contents)
with open(options.output, 'w') as f:
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
modes = stat.S_IWUSR | stat.S_IRUSR | stat.S_IWGRP | stat.S_IRGRP
with os.fdopen(os.open(options.output, flags, modes), 'w') as f:
for key in contents:
f.write("".join([key, "=", contents[key], '\n']))
......
......@@ -20,6 +20,8 @@ import sys
import argparse
import textwrap
import re
import os
import stat
supported_parse_item = ['arch', 'labelName', 'priority', 'allowList', 'blockList', 'priorityWithArgs',\
'allowListWithArgs', 'headFiles', 'selfDefineSyscall', 'returnValue', 'mode']
......@@ -834,7 +836,10 @@ class SeccompPolicyParser:
content = header + '\n'.join(extra_header_list) + array_name + \
' ' + '\n '.join(self.bpf_generator.bpf_policy) + footer
with open(args.dstfile, 'w') as output_file:
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
modes = stat.S_IWUSR | stat.S_IRUSR | stat.S_IWGRP | stat.S_IRGRP
with os.fdopen(os.open(args.dstfile, flags, modes), 'w') as output_file:
output_file.write(content)
@staticmethod
......
......@@ -36,7 +36,7 @@ extern char *__progname;
static int LoadSelinuxPolicy(int id, const char *name, int argc, const char **argv)
{
int ret;
char process_context[MAX_SECON_LEN];
char processContext[MAX_SECON_LEN];
UNUSED(id);
UNUSED(name);
......@@ -50,11 +50,11 @@ static int LoadSelinuxPolicy(int id, const char *name, int argc, const char **ar
PLUGIN_LOGI("main, load_policy success.");
}
ret = snprintf_s(process_context, sizeof(process_context), sizeof(process_context) - 1, "u:r:%s:s0", __progname);
ret = snprintf_s(processContext, sizeof(processContext), sizeof(processContext) - 1, "u:r:%s:s0", __progname);
if (ret == -1) {
setcon("u:r:init:s0");
} else {
setcon(process_context);
setcon(processContext);
}
(void)RestoreconRecurse("/dev");
return 0;
......
......@@ -329,8 +329,7 @@ int CheckMatchSubCondition(const char *condition, const char *input, int length)
PARAM_CHECK(condition != NULL, return 0, "Invalid condition");
PARAM_CHECK(input != NULL, return 0, "Invalid input");
const char *tmp = strstr(condition, input);
while (tmp != NULL)
{
while (tmp != NULL) {
PARAM_LOGV("CheckMatchSubCondition Condition: '%s' content: '%s' length %d", condition, input, length);
if (((int)strlen(tmp) <= length) || (tmp[length] != '=')) {
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册