Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Sep 2001 08:00:04 -0700 (PDT)
From:      Marc Olzheim <marcolz@ilse.nl>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/30247: sh cannot redirect to /dev/fd/1 or from /dev/fd/0
Message-ID:  <200109011500.f81F04Z17678@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/30247; it has been noted by GNATS.

From: Marc Olzheim <marcolz@ilse.nl>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109011500.f81F04Z17678>