sd-bus: do not fail if the passed memfd is already sealed

sd_bus_message_append_array_memfd() and
sd_bus_message_append_string_memfd() are public functions, hence the
passed fd may be already sealed by the caller. Let's gracefully handle
such case.

(cherry picked from commit 16025762d9055ec56694e4a1d74344029061b7c2)
This commit is contained in:
Yu Watanabe
2026-10-16 17:24:51 +01:00
committed by Luca Boccassi
parent b39f5cfa2e
commit ea044bd514
+2 -2
View File
@@ -2204,7 +2204,7 @@ _public_ int sd_bus_message_append_array_memfd(
assert_return(!m->sealed, -EPERM);
assert_return(!m->poisoned, -ESTALE);
r = memfd_set_sealed(memfd);
r = memfd_set_sealed_gracefully(memfd);
if (r < 0)
return r;
@@ -2284,7 +2284,7 @@ _public_ int sd_bus_message_append_string_memfd(
assert_return(!m->sealed, -EPERM);
assert_return(!m->poisoned, -ESTALE);
r = memfd_set_sealed(memfd);
r = memfd_set_sealed_gracefully(memfd);
if (r < 0)
return r;