From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH v2] Cygwin: console: Abort read() on signal if SA_RESTART is not set.
Date: Mon, 15 Feb 2021 22:08:07 +0900 [thread overview]
Message-ID: <20210215220807.aa6509ee83ee971597511770@nifty.ne.jp> (raw)
In-Reply-To: <20210215120441.GL4251@calimero.vinschen.de>
On Mon, 15 Feb 2021 13:04:41 +0100
Corinna Vinschen wrote:
> On Feb 14 18:42, Takashi Yano via Cygwin-patches wrote:
> > - Currently, console read() keeps reading after SIGWINCH is sent
> > even if SA_RESTART flag is not set. With this patch, read()
> > returns EINTR on SIGWINCH if SA_RESTART flag is not set.
> > The same problem for SIGQUIT and SIGTSTP has also been fixed.
> > ---
> > winsup/cygwin/fhandler_console.cc | 7 +++----
> > winsup/cygwin/fhandler_termios.cc | 1 +
> > winsup/cygwin/tty.cc | 1 +
> > winsup/cygwin/tty.h | 1 +
> > 4 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
> > index 3c0783575..78af6cf2b 100644
> > --- a/winsup/cygwin/fhandler_console.cc
> > +++ b/winsup/cygwin/fhandler_console.cc
> > @@ -586,12 +586,11 @@ wait_retry:
> > case input_ok: /* input ready */
> > break;
> > case input_signalled: /* signalled */
> > - release_input_mutex ();
> > - /* The signal will be handled by cygwait() above. */
> > - continue;
> > case input_winch:
> > release_input_mutex ();
> > - continue;
> > + if (global_sigs[get_ttyp ()->last_sig].sa_flags & SA_RESTART)
>
> Shouldn't this check for last_sig != 0 first?
This code is reached only after SIGINT, SIGTSTP, SIGQUIT (case
input_signalled) or SIGWINCH (case input_winch) has been sent.
Therefore, last_sig should be one of them here.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
next prev parent reply other threads:[~2021-02-15 13:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-14 9:42 Takashi Yano
2021-02-15 12:04 ` Corinna Vinschen
2021-02-15 13:08 ` Takashi Yano [this message]
2021-02-15 13:23 ` Corinna Vinschen
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=20210215220807.aa6509ee83ee971597511770@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--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).