summaryrefslogtreecommitdiffstats
path: root/bin/sh/redir.c
diff options
context:
space:
mode:
authorbabkin <babkin@FreeBSD.org>2001-12-22 02:40:58 +0000
committerbabkin <babkin@FreeBSD.org>2001-12-22 02:40:58 +0000
commita0dab54592c68768efcd3c5eaaf453ae08a76dc2 (patch)
tree6e68de5c653b38a32d8ca847ecf8d788e08786c3 /bin/sh/redir.c
parenta5097c5a6699bb2a0f61b5f178bba73dd7cb07f0 (diff)
downloadFreeBSD-src-a0dab54592c68768efcd3c5eaaf453ae08a76dc2.zip
FreeBSD-src-a0dab54592c68768efcd3c5eaaf453ae08a76dc2.tar.gz
Added ability to do ">/dev/stdout". The apsfilter people are anxious
to get it MFCed in time for release 4.5. MFC after: 2 weeks
Diffstat (limited to 'bin/sh/redir.c')
-rw-r--r--bin/sh/redir.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/bin/sh/redir.c b/bin/sh/redir.c
index ee893f4..8c05da9 100644
--- a/bin/sh/redir.c
+++ b/bin/sh/redir.c
@@ -145,11 +145,8 @@ again:
}
if (!try) {
sv->renamed[fd] = i;
- close(fd);
}
INTON;
- } else {
- close(fd);
}
if (fd == 0)
fd0_redirected++;
@@ -186,6 +183,7 @@ openredirect(redir, memory)
error("cannot open %s: %s", fname, errmsg(errno, E_OPEN));
movefd:
if (f != fd) {
+ close(fd);
copyfd(f, fd);
close(f);
}
OpenPOWER on IntegriCloud