Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Dec 2001 21:40:04 -0500
From:      Sergey Babkin <babkin@bellatlantic.net>
To:        Erik Trulsson <ertr1013@student.uu.se>
Cc:        Steve Price <steve@FreeBSD.org>, Andreas Klemm <andreas@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   sh patch Re: cvs commit: ports/print/apsfilter Makefile  ports/print/apsfilter/files patch-bin::aps2file  ports/print/apsfilter/scripts pre-configure
Message-ID:  <3C22A104.C0953230@bellatlantic.net>
References:  <200112171847.fBHIlbP69769@freefall.freebsd.org> <20011217130555.J72144@bsd.havk.org> <20011217201850.A21347@student.uu.se> <3C1FE5AF.5E93ED0D@bellatlantic.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------2CFE277C42EAE45E1A35A8F3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I wrote a patch that makes /bin/sh redirection to stdout work
(attached, apply in src/bin/sh). Please review it and/or test it
and let me know, and I'll commit it to -current.

-SB

> Erik Trulsson wrote:
> >
> > On Mon, Dec 17, 2001 at 01:05:55PM -0600, Steve Price wrote:
> > > On Mon, Dec 17, 2001 at 10:47:37AM -0800, Andreas Klemm wrote:
> > > >   Log:
> > > >   Unluckily FreeBSD's shell isn't able to read from/write to /dev/stdin
> > > >   and stdout.
> > >
> > > Perhaps I missed the discussion somewhere else but can you please
> > > explain what this means and give an example of a short script that
> > > doesn't work with /bin/sh?
> >
> > Just try the following command:
> >
> > echo "hello" > /dev/stdout
--------------2CFE277C42EAE45E1A35A8F3
Content-Type: text/plain; charset=us-ascii;
 name="redir.df"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="redir.df"

--- redir.c	2001/12/21 02:11:14	1.1
+++ redir.c	2001/12/21 02:30:03
@@ -145,11 +145,8 @@
 			}
 			if (!try) {
 				sv->renamed[fd] = i;
-				close(fd);
 			}
 			INTON;
-		} else {
-			close(fd);
 		}
 		if (fd == 0)
 			fd0_redirected++;
@@ -186,6 +183,7 @@
 			error("cannot open %s: %s", fname, errmsg(errno, E_OPEN));
 movefd:
 		if (f != fd) {
+			close(fd);
 			copyfd(f, fd);
 			close(f);
 		}

--------------2CFE277C42EAE45E1A35A8F3--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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