From owner-freebsd-bugs Sat Sep 1 8: 0: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7BD5A37B408 for ; Sat, 1 Sep 2001 08:00:04 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f81F04Z17678; Sat, 1 Sep 2001 08:00:04 -0700 (PDT) (envelope-from gnats) Date: Sat, 1 Sep 2001 08:00:04 -0700 (PDT) Message-Id: <200109011500.f81F04Z17678@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Marc Olzheim Subject: Re: bin/30247: sh cannot redirect to /dev/fd/1 or from /dev/fd/0 Reply-To: Marc Olzheim Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/30247; it has been noted by GNATS. From: Marc Olzheim To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/30247: sh cannot redirect to /dev/fd/1 or from /dev/fd/0 Date: Sat, 1 Sep 2001 16:56:48 +0200 It fails beacuse /dev/fd/1 is no longer connected because it is closed on redir.c:148. This seems to work: --- redir.c.orig Tue Oct 3 23:13:14 2000 +++ redir.c Sat Sep 1 16:14:30 2001 @@ -143,13 +143,9 @@ break; } } - if (!try) { + if (!try) sv->renamed[fd] = i; - close(fd); - } INTON; - } else { - close(fd); } if (fd == 0) fd0_redirected++; @@ -186,6 +182,7 @@ error("cannot open %s: %s", fname, errmsg(errno, E_OPEN)); movefd: if (f != fd) { + close(fd); copyfd(f, fd); close(f); } Marc To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message