Date: Sat, 2 Dec 2000 09:31:16 +0300 From: Vlad Skvortsov <vss@high.net.ru> To: Cliff Sarginson <cliff@raggedclown.net> Cc: freebsd-questions@freebsd.org Subject: Re: dup2/pipe issue Message-ID: <20001202093115.A1418@high.net.ru> In-Reply-To: <00120119122201.02179@buffy> References: <20001201010421.A68505@high.net.ru> <00120119122201.02179@buffy>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001202093115.A1418>