diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-11-10 21:26:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-11-10 21:26:40 +0000 |
commit | de8e8de6b77224e8b2ac3c698fbc2dabb934f77b (patch) | |
tree | d900abc4c52849fcd9a047dec413fa759453d5c3 /bin/ksh/io.c | |
parent | 507ab8275b041b65d552f065abafff05c014342e (diff) |
If "from fd" == "to fd" don't call dup2() or close "from fd".
Diffstat (limited to 'bin/ksh/io.c')
-rw-r--r-- | bin/ksh/io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ksh/io.c b/bin/ksh/io.c index 283488656a5..a20ceed3d8b 100644 --- a/bin/ksh/io.c +++ b/bin/ksh/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.12 2003/03/10 03:48:16 david Exp $ */ +/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */ /* * shell buffered IO and formatted output @@ -321,7 +321,7 @@ restfd(fd, ofd) shf_flush(&shf_iob[fd]); if (ofd < 0) /* original fd closed */ close(fd); - else { + else if (fd != ofd) { ksh_dup2(ofd, fd, TRUE); /* XXX: what to do if this fails? */ close(ofd); } |