On Jul 8 07:59, Takashi Yano wrote:
> Hi Corinna,
>
> On Fri, 7 Jul 2023 11:46:15 +0200
> Corinna Vinschen wrote:
> > On Jul 7 12:34, Takashi Yano wrote:
> > > diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
> > > index 18e0f3097..2aae2fd65 100644
> > > --- a/winsup/cygwin/dtable.cc
> > > +++ b/winsup/cygwin/dtable.cc
> > > @@ -600,7 +600,13 @@ fh_alloc (path_conv& pc)
> > > case FH_TTY:
> > > if (!pc.isopen ())
> > > {
> > > - fhraw = cnew_no_ctor (fhandler_console, -1);
> > > + if (CTTY_IS_VALID (myself->ctty))
> > > + {
> > > + if (iscons_dev (myself->ctty))
> > > + fhraw = cnew_no_ctor (fhandler_console, -1);
> > > + else
> > > + fhraw = cnew_no_ctor (fhandler_pty_slave, -1);
> > > + }
> >
> > What happens if CTTY_IS_VALID fails at this point? There's no
> > `else' catching that situation?
> >
> > > debug_printf ("not called from open for /dev/tty");
> > > }
> > > else if (!CTTY_IS_VALID (myself->ctty) && last_tty_dev
>
> That happens when CTTY is not assigned. In that case fhandler_nodevice
> is assigned at:
> https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/dtable.cc;h=18e0f3097823f00ff9651685be06583818eb2140;hb=e38f91d5a96c4554c69c833243e5afec8e3e90eb#l634
>
> Then fhandler_base::fstat() is called when stat() is called.
Oh, ok. Sorry, I was a bit puzzled by the missing else.
Please push.
Thanks,
Corinna