Bug 30252

Summary: Re: sh cannot redirect to /dev/fd/1 or from /dev/fd/0
Product: Base System Reporter: marcolz <marcolz>
Component: binAssignee: GNATS administrator <gnats-admin>
Status: Closed FIXED    
Severity: Affects Only Me CC: sys
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description marcolz 2001-09-01 15:20:00 UTC
 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
Comment 1 dd freebsd_committer freebsd_triage 2001-09-03 15:16:45 UTC
State Changed
From-To: open->closed

Not a new PR.