gwojda gros boulet

This commit is contained in:
gwojda 2017-03-20 18:28:13 +01:00
parent b9e5321b5b
commit 71f990edbe

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */ /* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
/* Updated: 2017/03/20 15:57:02 by gwojda ### ########.fr */ /* Updated: 2017/03/20 18:27:40 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -26,7 +26,7 @@ t_itof g_redirmap[] =
static void process_close(int fd1, int fd2) static void process_close(int fd1, int fd2)
{ {
if (fd1 != fd2) if (fd1 != fd2)
close(fd1); dup2_close(fd1, fd2);
} }
int process_redirect(t_process *p) int process_redirect(t_process *p)
@ -36,7 +36,8 @@ int process_redirect(t_process *p)
int i; int i;
redirs = p->redirs; redirs = p->redirs;
process_close(p->to_close, STDIN); if (p->to_close != STDIN)
dup2_close(p->fdout, STDOUT);
while (redirs) while (redirs)
{ {
redir = redirs->content; redir = redirs->content;