From: sos AT buggy DOT prospect DOT com DOT ru (Sergey Okhapkin) Subject: RE: Dup2 fix 1 Mar 1998 00:28:11 -0800 Message-ID: <01BD4503.88D9B770.cygnus.cygwin32.developers@sos> To: "cygwin32-developers AT cygnus DOT com" , "'cgf AT bbc DOT com'" Christopher Faylor wrote: > <> > I was surprised to find zsh stopped working with the release version of > B19. The reason is that it does an fdopen(..., "w+") on a file handle > that has been duped. > > Unfortunately, cygwin didn't preserve the settings file handles across > a dup. Apparently fdopen is now checking this more stringently. > > patch from cgf AT bbc DOT com (Christopher Faylor) > * pipe.cc (dup2): Ensure that an fd's flags are duplicated along > with the fd itself. > Chris, your patch looks strange for me... hinfo_vec::dup2() copies all flags! A had fdopen() problems with b19 release too, but solved them in a different way: fhandler.cc (fhandler_base::init): set file access flags corresponding to acees mode. net.cc include fcntl.h (fhandler_socket::fhandler_socket): set socket descriptor access flags to O_RDWR. -- Sergey Okhapkin, http://www.lexa.ru/sos Moscow, Russia Looking for a job begin 600 fdopen.diff M9&EF9B M=7 @+W=I;G-U<"]F:&%N9&QE