From: Long Wang Date: Sat, 8 Jul 2017 05:27:16 +0000 (+0800) Subject: utils: close parent end in child process after fork X-Git-Tag: lxc-1.0.11~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcc6437d91a52b57aa53ec9cf0acf60baac9f90e;p=thirdparty%2Flxc.git utils: close parent end in child process after fork Signed-off-by: Long Wang --- 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);