]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Close STDIN for early exec script.
authorWayne Davison <wayne@opencoder.net>
Sun, 21 Jun 2020 18:13:01 +0000 (11:13 -0700)
committerWayne Davison <wayne@opencoder.net>
Sun, 21 Jun 2020 18:17:09 +0000 (11:17 -0700)
NEWS.md
clientserver.c

diff --git a/NEWS.md b/NEWS.md
index 95016fe40de2d327e13dd60be8ed55644db35ad0..8b3e2ed06d3d4791cac26916a52a1c87c7586f83 100644 (file)
--- 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.
index b93251861d0e73762602b3280a26eb72077ea94d..819e9f24523ce8829e851b179a3b20d204b1a27f 100644 (file)
@@ -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))