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-2.1.0~62^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1686%2Fhead;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 e21985373..81f6987aa 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -490,6 +490,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);