]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: close parent end in child process after fork 1686/head
authorLong Wang <w@laoqinren.net>
Sat, 8 Jul 2017 05:27:16 +0000 (13:27 +0800)
committerLong Wang <w@laoqinren.net>
Sat, 8 Jul 2017 05:27:16 +0000 (13:27 +0800)
Signed-off-by: Long Wang <w@laoqinren.net>
src/lxc/utils.c

index e2198537374326105c79d205a77501959dbad37b..81f6987aae2a5a210ca7ca80d8407de27e28d4c8 100644 (file)
@@ -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);