summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-05-06 15:00:57 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2007-05-06 15:00:57 +1000
commit01e163ddd1afa14d64f432bacb967e9217010d38 (patch)
treeaf7d9608f64e21eefe594196bc389087f5178f72
parent[REDIR] Remove EMFILE special case (diff)
downloaddash-01e163ddd1afa14d64f432bacb967e9217010d38.tar.gz
dash-01e163ddd1afa14d64f432bacb967e9217010d38.zip
[EVAL] Use dup2 instead of copyfd in evalbackcmd
Since we know that dup2 must succeed here we can call it directly.
Diffstat (limited to '')
-rw-r--r--ChangeLog1
-rw-r--r--src/eval.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 98702d5..20c55d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* Removed unnecessary inclusion of redir.h from parser.c.
 	* Invoke sh_error on error in copyfd.
+	* Use dup2 instead of copyfd in evalbackcmd.
 
 2007-05-05  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/src/eval.c b/src/eval.c
index 07e7ee2..fed82d5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -625,8 +625,7 @@ evalbackcmd(union node *n, struct backcmd *result)
 			FORCEINTON;
 			close(pip[0]);
 			if (pip[1] != 1) {
-				close(1);
-				copyfd(pip[1], 1);
+				dup2(pip[1], 1);
 				close(pip[1]);
 			}
 			eflag = 0;