diff options
author | joerg <joerg@FreeBSD.org> | 1995-10-21 00:47:32 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-10-21 00:47:32 +0000 |
commit | 8deb9482ef65a6a3a773ac996395624316ba29cc (patch) | |
tree | 7f0e2b4fc502147d3a8088d2f968895f03e09628 /bin/sh/redir.c | |
parent | e22d8066c4c8851a3d1ce3cc8c5e5393cc6d148b (diff) | |
download | FreeBSD-src-8deb9482ef65a6a3a773ac996395624316ba29cc.zip FreeBSD-src-8deb9482ef65a6a3a773ac996395624316ba29cc.tar.gz |
o rename ulimit -p into ulimit -u, so we are in agreement with bash
o fix brokeness for 1>&5 redirection, where `5' was an invalid file
descriptor, but no error message has been generated
o fix brokeness for redirect to/from myself case
Diffstat (limited to 'bin/sh/redir.c')
-rw-r--r-- | bin/sh/redir.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/sh/redir.c b/bin/sh/redir.c index efd1d3a..47f964f 100644 --- a/bin/sh/redir.c +++ b/bin/sh/redir.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: redir.c,v 1.2 1994/09/24 02:58:10 davidg Exp $ + * $Id: redir.c,v 1.3 1995/05/30 00:07:22 rgrimes Exp $ */ #ifndef lint @@ -120,6 +120,9 @@ redirect(redir, flags) } for (n = redir ; n ; n = n->nfile.next) { fd = n->nfile.fd; + if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) && + n->ndup.dupfd == fd) + continue; /* redirect from/to myself */ if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) { INTOFF; if ((i = copyfd(fd, 10)) != EMPTY) { @@ -341,5 +344,7 @@ copyfd(from, to) { newfd = fcntl(from, F_DUPFD, to); if (newfd < 0 && errno == EMFILE) return EMPTY; + if (newfd < 0) + error("%d: %s", from, strerror(errno)); return newfd; } |