Skip to content

Commit

Permalink
utils: close parent end in child process after fork
Browse files Browse the repository at this point in the history
Signed-off-by: Long Wang <w@laoqinren.net>
  • Loading branch information
0x0916 authored and stgraber committed Aug 15, 2017
1 parent 4de8c04 commit dcc6437
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lxc/utils.c
Expand Up @@ -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);
Expand Down

0 comments on commit dcc6437

Please sign in to comment.