4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-28 03:27:46 +08:00

Cygwin: console: Abort read() on signal if SA_RESTART is not set.

- 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.
This commit is contained in:
Takashi Yano via Cygwin-patches 2021-02-14 18:42:50 +09:00 committed by Corinna Vinschen
parent 2b94fad48e
commit ad28775055
4 changed files with 6 additions and 4 deletions

View File

@ -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)
continue;
goto sig_exit;
default:
/* Should not come here */
release_input_mutex ();

View File

@ -133,6 +133,7 @@ tty_min::kill_pgrp (int sig)
siginfo_t si = {0};
si.si_signo = sig;
si.si_code = SI_KERNEL;
last_sig = sig;
for (unsigned i = 0; i < pids.npids; i++)
{

View File

@ -251,6 +251,7 @@ tty::init ()
master_is_running_as_service = false;
req_xfer_input = false;
pcon_input_state = to_cyg;
last_sig = 0;
}
HANDLE

View File

@ -48,6 +48,7 @@ public:
fh_devices ntty;
ULONGLONG last_ctrl_c; /* tick count of last ctrl-c */
bool is_console;
int last_sig;
IMPLEMENT_STATUS_FLAG (bool, initialized)
IMPLEMENT_STATUS_FLAG (bool, rstcons)