Unverified Commit dcc6437d by Long Wang Committed by Stéphane Graber

utils: close parent end in child process after fork

Signed-off-by: 's avatarLong Wang <w@laoqinren.net>
parent 4de8c04f
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment