From b75c1e611d984a2fe48236cd779b9edb1dfbecdd Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 18 Mar 2021 12:11:32 +0100 Subject: [PATCH] rexec: don't close stderr Otherwise we'll fail to attach to containers later on. Fixes: https://discuss.linuxcontainers.org/t/error-failed-to-retrieve-pid-of-executing-child-process Signed-off-by: Christian Brauner --- src/lxc/rexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/rexec.c b/src/lxc/rexec.c index b0bb9050c..508d7eadc 100644 --- a/src/lxc/rexec.c +++ b/src/lxc/rexec.c @@ -162,7 +162,7 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) if (execfd < 0) return; - ret = close_range(STDERR_FILENO, MAX_FILENO, CLOSE_RANGE_CLOEXEC); + ret = close_range(STDERR_FILENO + 1, MAX_FILENO, CLOSE_RANGE_CLOEXEC); if (ret && (errno != ENOSYS && errno != EINVAL)) fprintf(stderr, "%m - Failed to mark all file descriptors as close-on-exec\n"); fexecve(execfd, argv, envp); -- 2.47.2