From 6e7275d6bc619d926ca7688326d42cd66cd3d6c0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 28 Feb 2018 23:36:33 +0100 Subject: [PATCH] sd-bus: let's better not invade stdio territory when duplicating fds --- src/libelogind/sd-bus/bus-message.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libelogind/sd-bus/bus-message.c b/src/libelogind/sd-bus/bus-message.c index 5c91757aa..a0e4bc427 100644 --- a/src/libelogind/sd-bus/bus-message.c +++ b/src/libelogind/sd-bus/bus-message.c @@ -1400,7 +1400,7 @@ static int message_push_fd(sd_bus_message *m, int fd) { if (copy < 0) return -errno; - f = reallocarray(m->fds, sizeof(int), m->n_fds + 1); + f = realloc(m->fds, sizeof(int) * (m->n_fds + 1)); if (!f) { m->poisoned = true; safe_close(copy); @@ -2646,7 +2646,7 @@ _public_ int sd_bus_message_append_array_memfd( if (r < 0) return r; - copy_fd = dup(memfd); + copy_fd = fcntl(memfd, F_DUPFD_CLOEXEC, 3); if (copy_fd < 0) return copy_fd; @@ -2721,7 +2721,7 @@ _public_ int sd_bus_message_append_string_memfd( if (r < 0) return r; - copy_fd = dup(memfd); + copy_fd = fcntl(memfd, FD_CLOEXEC, 3); if (copy_fd < 0) return copy_fd; -- 2.30.2