提交 ee81f841 编写于 作者: C chengjinsong2

修改编译告警

Signed-off-by: Nchengjinsong2 <chengjinsong2@huawei.com>
Change-Id: I94d0a6a9b3d0f5eebb9a6b857e67c067a48c3c12
上级 765d8d31
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
static_library("hal_sys_param") { static_library("hal_sys_param") {
cflags = [ "-fno-common" ]
sources = [ "hal_sys_param.c" ] sources = [ "hal_sys_param.c" ]
include_dirs = [ "//base/startup/init/interfaces/hals" ] include_dirs = [ "//base/startup/init/interfaces/hals" ]
defines = [ defines = [
......
...@@ -122,6 +122,7 @@ if (defined(ohos_lite)) { ...@@ -122,6 +122,7 @@ if (defined(ohos_lite)) {
] ]
defines += [ "LITEOS_SUPPORT" ] defines += [ "LITEOS_SUPPORT" ]
sources += syspara_sources sources += syspara_sources
cflags = [ "-fno-common" ]
} else { } else {
sources += [ "syscap/init_syscap.c" ] sources += [ "syscap/init_syscap.c" ]
} }
......
...@@ -17,6 +17,7 @@ import optparse ...@@ -17,6 +17,7 @@ import optparse
import os import os
import sys import sys
import json import json
import stat
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, os.pardir, "build")) os.pardir, os.pardir, os.pardir, os.pardir, "build"))
...@@ -66,7 +67,9 @@ def fix_para_file(options): ...@@ -66,7 +67,9 @@ def fix_para_file(options):
if options.extra: if options.extra:
parse_extra_params(options.extra, contents) 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: for key in contents:
f.write("".join([key, "=", contents[key], '\n'])) f.write("".join([key, "=", contents[key], '\n']))
......
...@@ -34,6 +34,7 @@ if (defined(ohos_lite)) { ...@@ -34,6 +34,7 @@ if (defined(ohos_lite)) {
"_GNU_SOURCE", "_GNU_SOURCE",
"OHOS_LITE", "OHOS_LITE",
] ]
cflags = [ "-fno-common" ]
include_dirs = comm_include include_dirs = comm_include
sources = [ "param_hook.c" ] sources = [ "param_hook.c" ]
public_configs = [ ":inithook_config" ] public_configs = [ ":inithook_config" ]
......
...@@ -20,6 +20,8 @@ import sys ...@@ -20,6 +20,8 @@ import sys
import argparse import argparse
import textwrap import textwrap
import re import re
import os
import stat
supported_parse_item = ['arch', 'labelName', 'priority', 'allowList', 'blockList', 'priorityWithArgs',\ supported_parse_item = ['arch', 'labelName', 'priority', 'allowList', 'blockList', 'priorityWithArgs',\
'allowListWithArgs', 'headFiles', 'selfDefineSyscall', 'returnValue', 'mode'] 'allowListWithArgs', 'headFiles', 'selfDefineSyscall', 'returnValue', 'mode']
...@@ -834,7 +836,10 @@ class SeccompPolicyParser: ...@@ -834,7 +836,10 @@ class SeccompPolicyParser:
content = header + '\n'.join(extra_header_list) + array_name + \ content = header + '\n'.join(extra_header_list) + array_name + \
' ' + '\n '.join(self.bpf_generator.bpf_policy) + footer ' ' + '\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) output_file.write(content)
@staticmethod @staticmethod
......
...@@ -36,7 +36,7 @@ extern char *__progname; ...@@ -36,7 +36,7 @@ extern char *__progname;
static int LoadSelinuxPolicy(int id, const char *name, int argc, const char **argv) static int LoadSelinuxPolicy(int id, const char *name, int argc, const char **argv)
{ {
int ret; int ret;
char process_context[MAX_SECON_LEN]; char processContext[MAX_SECON_LEN];
UNUSED(id); UNUSED(id);
UNUSED(name); UNUSED(name);
...@@ -50,11 +50,11 @@ static int LoadSelinuxPolicy(int id, const char *name, int argc, const char **ar ...@@ -50,11 +50,11 @@ static int LoadSelinuxPolicy(int id, const char *name, int argc, const char **ar
PLUGIN_LOGI("main, load_policy success."); 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) { if (ret == -1) {
setcon("u:r:init:s0"); setcon("u:r:init:s0");
} else { } else {
setcon(process_context); setcon(processContext);
} }
(void)RestoreconRecurse("/dev"); (void)RestoreconRecurse("/dev");
return 0; return 0;
......
...@@ -41,13 +41,16 @@ base_include_dirs = [ ...@@ -41,13 +41,16 @@ base_include_dirs = [
if (defined(ohos_lite)) { if (defined(ohos_lite)) {
static_library("parameterbase") { static_library("parameterbase") {
cflags = [
"-fPIC",
"-fno-common",
]
sources = comm_sources sources = comm_sources
sources += [ sources += [
"//base/startup/init/services/log/init_commlog.c", "//base/startup/init/services/log/init_commlog.c",
"//base/startup/init/services/param/base/param_base.c", "//base/startup/init/services/param/base/param_base.c",
] ]
include_dirs = base_include_dirs include_dirs = base_include_dirs
cflags = [ "-fPIC" ]
defines = [ "_GNU_SOURCE" ] defines = [ "_GNU_SOURCE" ]
public_configs = [ ":exported_header_files" ] public_configs = [ ":exported_header_files" ]
......
...@@ -77,6 +77,7 @@ if (defined(ohos_lite)) { ...@@ -77,6 +77,7 @@ if (defined(ohos_lite)) {
if (defined(boot_kernel_extended_cmdline)) { if (defined(boot_kernel_extended_cmdline)) {
defines += [ "BOOT_EXTENDED_CMDLINE=\"${boot_kernel_extended_cmdline}\"" ] defines += [ "BOOT_EXTENDED_CMDLINE=\"${boot_kernel_extended_cmdline}\"" ]
} }
cflags = [ "-fno-common" ]
defines += [ defines += [
"_GNU_SOURCE", "_GNU_SOURCE",
"__LINUX__", "__LINUX__",
...@@ -94,8 +95,11 @@ if (defined(ohos_lite)) { ...@@ -94,8 +95,11 @@ if (defined(ohos_lite)) {
static_library("param_client") { static_library("param_client") {
include_dirs = param_include_dirs include_dirs = param_include_dirs
sources = param_client_sources sources = param_client_sources
cflags = [ "-fPIC" ]
public_configs = [ ":exported_header_files" ] public_configs = [ ":exported_header_files" ]
cflags = [
"-fPIC",
"-fno-common",
]
defines = [ defines = [
"_GNU_SOURCE", "_GNU_SOURCE",
"__LINUX__", "__LINUX__",
......
...@@ -329,8 +329,7 @@ int CheckMatchSubCondition(const char *condition, const char *input, int length) ...@@ -329,8 +329,7 @@ int CheckMatchSubCondition(const char *condition, const char *input, int length)
PARAM_CHECK(condition != NULL, return 0, "Invalid condition"); PARAM_CHECK(condition != NULL, return 0, "Invalid condition");
PARAM_CHECK(input != NULL, return 0, "Invalid input"); PARAM_CHECK(input != NULL, return 0, "Invalid input");
const char *tmp = strstr(condition, 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); PARAM_LOGV("CheckMatchSubCondition Condition: '%s' content: '%s' length %d", condition, input, length);
if (((int)strlen(tmp) <= length) || (tmp[length] != '=')) { if (((int)strlen(tmp) <= length) || (tmp[length] != '=')) {
return 0; return 0;
......
...@@ -17,6 +17,7 @@ if (defined(ohos_lite)) { ...@@ -17,6 +17,7 @@ if (defined(ohos_lite)) {
"//base/startup/init/services/log/init_commlog.c", "//base/startup/init/services/log/init_commlog.c",
"//base/startup/init/watchdog/init_watchdog.c", "//base/startup/init/watchdog/init_watchdog.c",
] ]
cflags = [ "-fno-common" ]
deps = [ deps = [
"//base/startup/init/services/log:init_log", "//base/startup/init/services/log:init_log",
"//third_party/bounds_checking_function:libsec_static", "//third_party/bounds_checking_function:libsec_static",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册