From 07502a444b06ade0c976629e392980f035f2fcc5 Mon Sep 17 00:00:00 2001 From: cheng_jinsong Date: Fri, 9 Sep 2022 08:15:48 +0000 Subject: [PATCH] codex Signed-off-by: cheng_jinsong --- scripts/param_cfg_to_code.py | 3 ++- services/init/init_common_service.c | 2 +- .../modules/seccomp/scripts/generate_code_from_policy.py | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/param_cfg_to_code.py b/scripts/param_cfg_to_code.py index edb8e7d7..50c9ee5e 100755 --- a/scripts/param_cfg_to_code.py +++ b/scripts/param_cfg_to_code.py @@ -144,7 +144,8 @@ def main(): for source in args.source: print("source {}".format(out_dir)) - assert os.path.exists(source) + if not os.path.exists(source): + raise FileNotFoundError src_dict = get_param_from_cfg(source) dst = "".join([out_dir, "param_cfg.h"]) diff --git a/services/init/init_common_service.c b/services/init/init_common_service.c index 1ed3a958..f6d25a50 100644 --- a/services/init/init_common_service.c +++ b/services/init/init_common_service.c @@ -474,7 +474,7 @@ static void CheckServiceSocket(Service *service) return; } -static void CheckOndemandService(service) +static void CheckOndemandService(Service *service) { CheckServiceSocket(service); if (strcmp(service->name, "console") == 0) { diff --git a/services/modules/seccomp/scripts/generate_code_from_policy.py b/services/modules/seccomp/scripts/generate_code_from_policy.py index 7eedb3fb..ce71daa4 100755 --- a/services/modules/seccomp/scripts/generate_code_from_policy.py +++ b/services/modules/seccomp/scripts/generate_code_from_policy.py @@ -747,7 +747,8 @@ class SeccompPolicyParser: with open(args.dstfile, 'w') as output_file: output_file.write(content) - def filter_syscalls_nr(self, name_to_nr): + @staticmethod + def filter_syscalls_nr(name_to_nr): syscalls = {} for syscall_name, nr in name_to_nr.items(): if not syscall_name.startswith("__NR_") and not syscall_name.startswith("__ARM_NR_"): @@ -776,7 +777,7 @@ class SeccompPolicyParser: continue try: name = k.group(1) - nr = eval(mark_pattern.sub(lambda x: str(name_to_nr[x.group(0)]), + nr = eval(mark_pattern.sub(lambda x: str(name_to_nr.get(x.group(0))), k.group(2))) name_to_nr[name] = nr -- GitLab