Don't raise SIGTTIN from poll/select

SIGTTIN should be raised when read() is made on a tty in a backgrounded
process, but not when it's tested with poll()/select().

I guess poll()/select() does need to call bg_check(), in order to detect the
error conditions that notices (that is, if bg_check() returns bg_eof or
bg_error, then fd is ready as an error condition exists) so add an optional
parameter to fhandler_base::bg_select() to indicate that signals aren't
desired.

See https://cygwin.com/ml/cygwin-developers/2016-07/msg00004.html
This commit is contained in:
Corinna Vinschen
2016-07-26 19:03:07 +01:00
committed by Jon Turney
parent 10a30e7a25
commit 32b668d966
3 changed files with 41 additions and 10 deletions

View File

@ -645,7 +645,7 @@ peek_pipe (select_record *s, bool from_select)
}
}
if (fh->bg_check (SIGTTIN) <= bg_eof)
if (fh->bg_check (SIGTTIN, true) <= bg_eof)
{
gotone = s->read_ready = true;
goto out;
@ -884,7 +884,7 @@ peek_console (select_record *me, bool)
set_handle_or_return_if_not_open (h, me);
for (;;)
if (fh->bg_check (SIGTTIN) <= bg_eof)
if (fh->bg_check (SIGTTIN, true) <= bg_eof)
return me->read_ready = true;
else if (!PeekConsoleInput (h, &irec, 1, &events_read) || !events_read)
break;