From dcc6437d91a52b57aa53ec9cf0acf60baac9f90e Mon Sep 17 00:00:00 2001 From: Long Wang Date: Sat, 8 Jul 2017 13:27:16 +0800 Subject: [PATCH] utils: close parent end in child process after fork Signed-off-by: Long Wang --- src/lxc/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 620f05256..9f32f334b 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -438,6 +438,9 @@ extern struct lxc_popen_FILE *lxc_popen(const char *command) /* child */ int child_std_end = STDOUT_FILENO; + close(parent_end); + parent_end = -1; + if (child_end != child_std_end) { /* dup2() doesn't dup close-on-exec flag */ dup2(child_end, child_std_end); -- 2.47.2