]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: close parent end in child process after fork
authorLong Wang <w@laoqinren.net>
Sat, 8 Jul 2017 05:27:16 +0000 (13:27 +0800)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 15 Aug 2017 22:56:18 +0000 (18:56 -0400)
Signed-off-by: Long Wang <w@laoqinren.net>
src/lxc/utils.c

index 620f0525636f4a820ed34d200d5c75bd34011429..9f32f334b1646243aa3144c6042e9b68dcdc8ae8 100644 (file)
@@ -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);