* exceptions.cc (ctrl_c_handler): Only send SIGINT when we have a controlling

terminal and we are the head of the process group.
This commit is contained in:
Christopher Faylor 2001-09-05 02:42:49 +00:00
parent 615a70a882
commit d72a655937
2 changed files with 8 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Tue Sep 4 22:42:13 2001 Christopher Faylor <cgf@cygnus.com>
* exceptions.cc (ctrl_c_handler): Only send SIGINT when we have a
controlling terminal and we are the head of the process group.
Tue Sep 4 16:48:14 2001 Christopher Faylor <cgf@cygnus.com> Tue Sep 4 16:48:14 2001 Christopher Faylor <cgf@cygnus.com>
* thread.cc (InterlockedExchangePointer): Don't define if it already * thread.cc (InterlockedExchangePointer): Don't define if it already

View File

@ -912,11 +912,8 @@ ctrl_c_handler (DWORD type)
tty_min *t = cygwin_shared->tty.get_tty (myself->ctty); tty_min *t = cygwin_shared->tty.get_tty (myself->ctty);
/* Ignore this if we're not the process group lead since it should be handled /* Ignore this if we're not the process group lead since it should be handled
*by* the process group leader. */ *by* the process group leader. */
if (t->getpgid () && pid_exists (t->getpgid ()) && if (myself->ctty != -1 && t->getpgid () == myself->pid &&
(t->getpgid () != myself->pid || (GetTickCount () - t->last_ctrl_c) >= MIN_CTRL_C_SLOP)
(GetTickCount () - t->last_ctrl_c) < MIN_CTRL_C_SLOP))
return TRUE;
else
/* Otherwise we just send a SIGINT to the process group and return TRUE (to indicate /* Otherwise we just send a SIGINT to the process group and return TRUE (to indicate
that we have handled the signal). At this point, type should be that we have handled the signal). At this point, type should be
a CTRL_C_EVENT or CTRL_BREAK_EVENT. */ a CTRL_C_EVENT or CTRL_BREAK_EVENT. */
@ -926,6 +923,7 @@ ctrl_c_handler (DWORD type)
t->last_ctrl_c = GetTickCount (); t->last_ctrl_c = GetTickCount ();
return TRUE; return TRUE;
} }
return TRUE;
} }
/* Set the signal mask for this process. /* Set the signal mask for this process.