From owner-freebsd-questions Sat Dec 2 13:30:50 2000 Delivered-To: freebsd-questions@freebsd.org Received: from siemens.ulstu.ru (siemens.ulstu.ru [62.76.34.44]) by hub.freebsd.org (Postfix) with ESMTP id 5DF9937B400 for ; Sat, 2 Dec 2000 13:30:45 -0800 (PST) Received: from hq.spc.high (co3-a15.link-ul.ru [195.151.42.241]) by siemens.ulstu.ru (Postfix-ULSTU) with ESMTP id A918817471; Sun, 3 Dec 2000 00:30:18 +0300 (MSK) Received: by hq.spc.high (Postfix-ULSTU, from userid 1000) id BB8ABB49; Sat, 2 Dec 2000 09:31:16 +0300 (MSK) Date: Sat, 2 Dec 2000 09:31:16 +0300 From: Vlad Skvortsov To: Cliff Sarginson Cc: freebsd-questions@freebsd.org Subject: Re: dup2/pipe issue Message-ID: <20001202093115.A1418@high.net.ru> References: <20001201010421.A68505@high.net.ru> <00120119122201.02179@buffy> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: <00120119122201.02179@buffy> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Dec 01, 2000 at 07:12:22PM +0100, Cliff Sarginson wrote: > > /* to_us and from_us are pipes to and from our process, > > 0th element is read end, 1st - write end. > > sd is connected socket. > > */ > > close (from_us[0]); > > close (to_us[1]); > > dup_sock = dup (sd); > > dup_out = dup (from_us[1]); > > dup_in = dup (to_us[0]); > > dup2 (dup_in, 0); > > dup2 (dup_out, 1); > > dup2 (dup_sock, 2); > > /* Child won't need anything except fds 0-2 */ > > for (i = 3; i < file_descriptors_table_size; i ++) > > close (i); > Gut reaction.. The very first thing you should do is to comment out the closes > above and then test it. They are not functionally needed, and complicate the > issue. Removing close calls doesn't affect the issue - the pipe gets broken on last dup2 call. Of course removing close calls was the first thing I did. > I will look at it further when I get time.. and respond if I have anything > useful... Okay. -- Vlad Skvortsov, vss@ulstu.ru, vss@high.net.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message