From e8d4909b444b1987c7e25256030323816841cff6 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 17 Sep 2026 02:41:37 +0900 Subject: [PATCH] sd-bus: fix invalid fcntl() argument and error handling Fixes 40164c2cebba6447c23939b8dd4bb5ec6da07013. (cherry picked from commit 4738dd120dcd4e7ee9c0bb825a41633aad15b0bd) --- src/libsystemd/sd-bus/bus-message.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 09286f4333..55b07fece0 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -2210,7 +2210,7 @@ _public_ int sd_bus_message_append_array_memfd( copy_fd = fcntl(memfd, F_DUPFD_CLOEXEC, 3); if (copy_fd < 0) - return copy_fd; + return -errno; r = memfd_get_size(memfd, &real_size); if (r < 0) @@ -2283,9 +2283,9 @@ _public_ int sd_bus_message_append_string_memfd( if (r < 0) return r; - copy_fd = fcntl(memfd, FD_CLOEXEC, 3); + copy_fd = fcntl(memfd, F_DUPFD_CLOEXEC, 3); if (copy_fd < 0) - return copy_fd; + return -errno; r = memfd_get_size(memfd, &real_size); if (r < 0)