From owner-cvs-all Fri Dec 21 5: 3:53 2001 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 756A337B405; Fri, 21 Dec 2001 05:03:44 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id AAA04112; Sat, 22 Dec 2001 00:03:40 +1100 Date: Sat, 22 Dec 2001 00:03:42 +1100 (EST) From: Bruce Evans X-X-Sender: To: Cc: Erik Trulsson , Steve Price , Andreas Klemm , , Subject: Re: sh patch Re: cvs commit: ports/print/apsfilter Makefile ports/print/apsfilter/files patch-bin::aps2file ports/print/apsfilter/scripts pre-configure In-Reply-To: <3C22A104.C0953230@bellatlantic.net> Message-ID: <20011222000107.C4679-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 20 Dec 2001, Sergey Babkin wrote: > 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. > --- 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); > } This seems to introduce a race by moving the close after the INTON. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message