From: Daan De Meyer Date: Wed, 23 Apr 2025 13:48:13 +0000 (+0200) Subject: core: Use parse_syscall_archs() in bus_exec_context_set_transient_property() X-Git-Tag: v258-rc1~748^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8621c646b8e5ce5da981fd317cd37c038551338f;p=thirdparty%2Fsystemd.git core: Use parse_syscall_archs() in bus_exec_context_set_transient_property() --- diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 3953e775ecd..2a257f12603 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -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) diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index 5234f11ea0e..7f6d6103b82 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -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; }