Browse Source

[enh] right_redirections: close fd and restore stdout.

Moul 2 years ago
parent
commit
b47bd878ca
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/redirect.c

+ 4 - 0
src/redirect.c

@@ -51,6 +51,7 @@ void	open_right_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
 
 /*
 ** if != <<: close fd, restore stdfd
+** right_redirections: close fd_file, restore stdout
 */
 
 void	close_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
@@ -63,5 +64,8 @@ void	close_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
 		else
 			close(0);
 		dup(p->fd[p->i][1]);
+		close(e->fd_file);
+		close(STDOUT);
+		dup(e->fdout);
 	}
 }