From b107d53463033d41c22bd8e13569385361c1a82a Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Mon, 27 Mar 2017 03:19:22 +0200 Subject: [PATCH] [redirection] :sheep: close #206 --- 42sh/src/exec/redirect_greatand.c | 4 ++-- 42sh/src/exec/redirect_lessand.c | 4 ++-- 42sh/src/job_control/job_update_status.c | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/42sh/src/exec/redirect_greatand.c b/42sh/src/exec/redirect_greatand.c index 10c979ac..e241ba40 100644 --- a/42sh/src/exec/redirect_greatand.c +++ b/42sh/src/exec/redirect_greatand.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */ -/* Updated: 2017/03/25 00:58:22 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 03:18:37 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,7 +32,7 @@ int redirect_greatand(t_redir *redir) if (fdold > 9) return (bad_fd(fdold)); if (fd_is_valid(fdold, O_WRONLY | O_RDWR)) - fd_replace(fdold, fdnew); + dup2(fdold, fdnew); else return (bad_fd(fdold)); return (0); diff --git a/42sh/src/exec/redirect_lessand.c b/42sh/src/exec/redirect_lessand.c index 0f4f5928..1be9e62c 100644 --- a/42sh/src/exec/redirect_lessand.c +++ b/42sh/src/exec/redirect_lessand.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:11:18 by jhalford #+# #+# */ -/* Updated: 2017/03/21 16:33:43 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 03:18:44 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,7 +32,7 @@ int redirect_lessand(t_redir *redir) if (fdold > 9) return (bad_fd(fdold)); if (fd_is_valid(fdold, O_RDONLY | O_RDWR)) - fd_replace(fdold, fdnew); + dup2(fdold, fdnew); else return (bad_fd(fdold)); return (0); diff --git a/42sh/src/job_control/job_update_status.c b/42sh/src/job_control/job_update_status.c index 4467696e..8b00a02b 100644 --- a/42sh/src/job_control/job_update_status.c +++ b/42sh/src/job_control/job_update_status.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 12:56:11 by jhalford #+# #+# */ -/* Updated: 2017/03/27 03:07:57 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 03:17:54 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,6 @@ void job_update_status(void) if ((pid = waitpid(WAIT_ANY, &status, WUNTRACED | WNOHANG)) == -1 && errno != ECHILD) SH_ERR("waitpid(): %s", strerror(errno)); - DG("wait trigger pid=%i", pid); if (pid <= 1 || mark_process_status(pid, status)) break ; }