public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH 1/2] Cygwin: stat(): Fix "Bad address" error on stat() for /dev/tty.
Date: Fri, 7 Jul 2023 11:46:15 +0200	[thread overview]
Message-ID: <ZKfe55PgjTJwWmIQ@calimero.vinschen.de> (raw)
In-Reply-To: <20230707033458.1034-2-takashi.yano@nifty.ne.jp>

Hi Takashi,

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


Thanks,
Corinna

  reply	other threads:[~2023-07-07  9:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07  3:34 [PATCH 0/2] Fix issues of stat()/fstat() " Takashi Yano
2023-07-07  3:34 ` [PATCH 1/2] Cygwin: stat(): Fix "Bad address" error on stat() " Takashi Yano
2023-07-07  9:46   ` Corinna Vinschen [this message]
2023-07-07 22:59     ` Takashi Yano
2023-07-10  8:31       ` Corinna Vinschen
2023-07-07  3:34 ` [PATCH 2/2] Cygwin: fstat(): Fix st_rdev returned by fstat() " Takashi Yano
2023-07-07 10:10   ` Corinna Vinschen
2023-07-07 23:01     ` Takashi Yano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZKfe55PgjTJwWmIQ@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).