core: Use parse_syscall_archs() in bus_exec_context_set_transient_property()
This commit is contained in:
committed by
Yu Watanabe
parent
058d680625
commit
8621c646b8
+5
-12
@@ -2771,18 +2771,11 @@ int bus_exec_context_set_transient_property(
|
||||
|
||||
if (strv_isempty(l))
|
||||
c->syscall_archs = set_free(c->syscall_archs);
|
||||
else
|
||||
STRV_FOREACH(s, l) {
|
||||
uint32_t a;
|
||||
|
||||
r = seccomp_arch_from_string(*s, &a);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = set_ensure_put(&c->syscall_archs, NULL, UINT32_TO_PTR(a + 1));
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
else {
|
||||
r = parse_syscall_archs(l, &c->syscall_archs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
joined = strv_join(l, " ");
|
||||
if (!joined)
|
||||
|
||||
@@ -2019,12 +2019,11 @@ int seccomp_restrict_archs(Set *archs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_syscall_archs(char **l, Set **ret_archs) {
|
||||
_cleanup_set_free_ Set *archs = NULL;
|
||||
int parse_syscall_archs(char **l, Set **archs) {
|
||||
int r;
|
||||
|
||||
assert(l);
|
||||
assert(ret_archs);
|
||||
assert(archs);
|
||||
|
||||
STRV_FOREACH(s, l) {
|
||||
uint32_t a;
|
||||
@@ -2033,12 +2032,11 @@ int parse_syscall_archs(char **l, Set **ret_archs) {
|
||||
if (r < 0)
|
||||
return -EINVAL;
|
||||
|
||||
r = set_ensure_put(&archs, NULL, UINT32_TO_PTR(a + 1));
|
||||
r = set_ensure_put(archs, NULL, UINT32_TO_PTR(a + 1));
|
||||
if (r < 0)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
*ret_archs = TAKE_PTR(archs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user