[PATCH v2] Cygwin: console: Abort read() on signal if SA_RESTART is not set.
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Feb 15 13:23:38 GMT 2021
On Feb 15 22:08, Takashi Yano via Cygwin-patches wrote:
> 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.
Thanks, pushed.
Corinna
More information about the Cygwin-patches
mailing list