1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

seccomp: use FLAGS_SET() macro

This commit is contained in:
Yu Watanabe 2021-03-08 11:58:58 +09:00
parent 084a46d7c5
commit 9e29ee4072

View File

@ -1144,10 +1144,10 @@ int seccomp_parse_syscall_filter(
set = syscall_filter_set_find(name); set = syscall_filter_set_find(name);
if (!set) { if (!set) {
if (!(flags & SECCOMP_PARSE_PERMISSIVE)) if (!FLAGS_SET(flags, SECCOMP_PARSE_PERMISSIVE))
return -EINVAL; return -EINVAL;
log_syntax(unit, flags & SECCOMP_PARSE_LOG ? LOG_WARNING : LOG_DEBUG, filename, line, 0, log_syntax(unit, FLAGS_SET(flags, SECCOMP_PARSE_LOG) ? LOG_WARNING : LOG_DEBUG, filename, line, 0,
"Unknown system call group, ignoring: %s", name); "Unknown system call group, ignoring: %s", name);
return 0; return 0;
} }
@ -1166,10 +1166,10 @@ int seccomp_parse_syscall_filter(
id = seccomp_syscall_resolve_name(name); id = seccomp_syscall_resolve_name(name);
if (id == __NR_SCMP_ERROR) { if (id == __NR_SCMP_ERROR) {
if (!(flags & SECCOMP_PARSE_PERMISSIVE)) if (!FLAGS_SET(flags, SECCOMP_PARSE_PERMISSIVE))
return -EINVAL; return -EINVAL;
log_syntax(unit, flags & SECCOMP_PARSE_LOG ? LOG_WARNING : LOG_DEBUG, filename, line, 0, log_syntax(unit, FLAGS_SET(flags, SECCOMP_PARSE_LOG) ? LOG_WARNING : LOG_DEBUG, filename, line, 0,
"Failed to parse system call, ignoring: %s", name); "Failed to parse system call, ignoring: %s", name);
return 0; return 0;
} }
@ -1181,7 +1181,7 @@ int seccomp_parse_syscall_filter(
if (r < 0) if (r < 0)
switch (r) { switch (r) {
case -ENOMEM: case -ENOMEM:
return flags & SECCOMP_PARSE_LOG ? log_oom() : -ENOMEM; return FLAGS_SET(flags, SECCOMP_PARSE_LOG) ? log_oom() : -ENOMEM;
case -EEXIST: case -EEXIST:
assert_se(hashmap_update(filter, INT_TO_PTR(id + 1), INT_TO_PTR(errno_num)) == 0); assert_se(hashmap_update(filter, INT_TO_PTR(id + 1), INT_TO_PTR(errno_num)) == 0);
break; break;