]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
exec-util: make sure to close all fds for invoked generators 33072/head
authorLennart Poettering <lennart@poettering.net>
Wed, 29 May 2024 09:50:54 +0000 (11:50 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 29 May 2024 12:43:40 +0000 (14:43 +0200)
We should really have set O_CLOEXEC for all our fds, but better be safe
than sorry.

src/shared/exec-util.c

index 575e4de786c8ecc99ac4abe493f918976b63a1c5..996edbf997a60f92deb82f9390430e35228d3aff 100644 (file)
@@ -58,7 +58,7 @@ static int do_spawn(
                         "(direxec)",
                         (const int[]) { STDIN_FILENO, stdout_fd < 0 ? STDOUT_FILENO : stdout_fd, STDERR_FILENO },
                         /* except_fds= */ NULL, /* n_except_fds= */ 0,
-                        FORK_DEATHSIG_SIGTERM|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE|FORK_REARRANGE_STDIO,
+                        FORK_DEATHSIG_SIGTERM|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE|FORK_REARRANGE_STDIO|FORK_CLOSE_ALL_FDS,
                         &pid);
         if (r < 0)
                 return r;