From 2e1b46db3912cc3542a6ef0d7507c60ab282deaf Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 21 Jun 2020 11:13:01 -0700 Subject: [PATCH] Close STDIN for early exec script. --- NEWS.md | 2 ++ clientserver.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 95016fe4..8b3e2ed0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,6 +19,8 @@ Protocol: 31 (unchanged) - Fix an issue with the md2man code when building in an external dir. + - Make sure "early exec" gets no stdin. + ### ENHANCEMENTS: - Added "atimes" to the capabilities list that `--version` outputs. diff --git a/clientserver.c b/clientserver.c index b9325186..819e9f24 100644 --- a/clientserver.c +++ b/clientserver.c @@ -434,11 +434,12 @@ static pid_t start_pre_exec(const char *cmd, int *arg_fd_ptr, int *error_fd_ptr) } if (error_fd_ptr) { - close(STDIN_FILENO); dup2(error_fds[1], STDOUT_FILENO); close(error_fds[1]); } + close(STDIN_FILENO); + status = shell_exec(cmd); if (!WIFEXITED(status)) -- 2.47.2