On Jul 24 15:06, Corinna Vinschen wrote: > On Jul 24 20:57, Takashi Yano wrote: > > Previously, process_fd failed to correctly handle fhandlers using an > > archetype. This was due to the missing PATH_OPEN flag in path_conv, > > which caused build_fh_pc() to skip archetype initialization. The > > root cause was a bug where open() did not set the PATH_OPEN flag > > for fhandlers using an archetype. > > > > This patch introduces a new method, path_conv::set_isopen(), to > > explicitly set the PATH_OPEN flag in path_flags in fhandler_base:: > > open_with_arch(). > > Wouldn't this patch fix the problem as well? > > diff --git a/winsup/cygwin/fhandler/console.cc > b/winsup/cygwin/fhandler/console.cc > index 887e2ef722bf..2801c806edd5 100644 > --- a/winsup/cygwin/fhandler/console.cc > +++ b/winsup/cygwin/fhandler/console.cc > @@ -4311,7 +4311,7 @@ fhandler_console::init (HANDLE h, DWORD a, mode_t bin, > int64_t dummy) > { > // this->fhandler_termios::init (h, mode, bin); > /* Ensure both input and output console handles are open */ > - int flags = 0; > + int flags = PC_OPEN; > > a &= GENERIC_READ | GENERIC_WRITE; > if (a == GENERIC_READ) > diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc > index 77a363eb0e3b..10785e240091 100644 > --- a/winsup/cygwin/fhandler/pty.cc > +++ b/winsup/cygwin/fhandler/pty.cc > @@ -1015,7 +1015,7 @@ fhandler_pty_slave::close (int flag) > int > fhandler_pty_slave::init (HANDLE h, DWORD a, mode_t, int64_t dummy) > { > - int flags = 0; > + int flags = PC_OPEN; > > a &= GENERIC_READ | GENERIC_WRITE; > if (a == GENERIC_READ) > > > Corinna
No, it wouldn't. flags are not or'ed in the followup code. Sigh. diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc index 887e2ef722bf..57e69f2c9791 100644 --- a/winsup/cygwin/fhandler/console.cc +++ b/winsup/cygwin/fhandler/console.cc @@ -4311,15 +4311,15 @@ fhandler_console::init (HANDLE h, DWORD a, mode_t bin, int64_t dummy) { // this->fhandler_termios::init (h, mode, bin); /* Ensure both input and output console handles are open */ - int flags = 0; + int flags = PC_OPEN; a &= GENERIC_READ | GENERIC_WRITE; if (a == GENERIC_READ) - flags = O_RDONLY; - if (a == GENERIC_WRITE) - flags = O_WRONLY; - if (a == (GENERIC_READ | GENERIC_WRITE)) - flags = O_RDWR; + flags |= O_RDONLY; + else if (a == GENERIC_WRITE) + flags |= O_WRONLY; + else if (a == (GENERIC_READ | GENERIC_WRITE)) + flags |= O_RDWR; open_with_arch (flags | O_BINARY | (h ? 0 : O_NOCTTY)); return !tcsetattr (0, &get_ttyp ()->ti); diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc index 77a363eb0e3b..ef0f2d766bc3 100644 --- a/winsup/cygwin/fhandler/pty.cc +++ b/winsup/cygwin/fhandler/pty.cc @@ -1015,15 +1015,15 @@ fhandler_pty_slave::close (int flag) int fhandler_pty_slave::init (HANDLE h, DWORD a, mode_t, int64_t dummy) { - int flags = 0; + int flags = PC_OPEN; a &= GENERIC_READ | GENERIC_WRITE; if (a == GENERIC_READ) - flags = O_RDONLY; - if (a == GENERIC_WRITE) - flags = O_WRONLY; - if (a == (GENERIC_READ | GENERIC_WRITE)) - flags = O_RDWR; + flags |= O_RDONLY; + else if (a == GENERIC_WRITE) + flags |= O_WRONLY; + else if (a == (GENERIC_READ | GENERIC_WRITE)) + flags |= O_RDWR; int ret = open_with_arch (flags); Corinna