|
Zbigniew Jędrzejewski-Szmek |
a94605 |
From 8263be4e65e565d8abb1d00f1c0e6ca9af44a4d1 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
From: Lennart Poettering <lennart@poettering.net>
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
Date: Wed, 29 May 2024 11:50:54 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
Subject: [PATCH 3/3] exec-util: make sure to close all fds for invoked
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
generators
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
We should really have set O_CLOEXEC for all our fds, but better be safe
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
than sorry.
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
src/shared/exec-util.c | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
index dc0974572f..ac1c150ab1 100644
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
--- a/src/shared/exec-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
+++ b/src/shared/exec-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
@@ -58,7 +58,7 @@ static int do_spawn(
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
"(direxec)",
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
(const int[]) { STDIN_FILENO, stdout_fd < 0 ? STDOUT_FILENO : stdout_fd, STDERR_FILENO },
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
/* except_fds= */ NULL, /* n_except_fds= */ 0,
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
- FORK_DEATHSIG_SIGTERM|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE|FORK_REARRANGE_STDIO,
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
+ FORK_DEATHSIG_SIGTERM|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE|FORK_REARRANGE_STDIO|FORK_CLOSE_ALL_FDS,
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
&pid;;
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
--
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
2.45.0
|
|
Zbigniew Jędrzejewski-Szmek |
a94605 |
|