From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 06DEF3858D35; Wed, 3 Nov 2021 14:12:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06DEF3858D35 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: console: Prevent the exec'ed bash from exiting by Ctrl-C. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: b01b5e45e96919b8776dd0569fd76d57866e29c2 X-Git-Newrev: b3d2f35cb1a62daf92d88e1aecc2a235d843dbca Message-Id: <20211103141247.06DEF3858D35@sourceware.org> Date: Wed, 3 Nov 2021 14:12:47 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2021 14:12:47 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b3d2f35cb1a62daf92d88e1aecc2a235d843dbca commit b3d2f35cb1a62daf92d88e1aecc2a235d843dbca Author: Takashi Yano Date: Wed Nov 3 15:14:42 2021 +0900 Cygwin: console: Prevent the exec'ed bash from exiting by Ctrl-C. - Currently, bash occasionally exits by Ctrl-C with the following scenario. 1) Start bash in the command prompt. 2) Run 'exec bash'. 3) Press Ctrl-C several times. This patch fixes the issue. Diff: --- winsup/cygwin/sigproc.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 47352c213..dff797915 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -594,6 +594,14 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) p = myself; } + /* If myself is the stub process, send signal to the child process + rather than myself. The fact that myself->dwProcessId is not equal + to the current process id indicates myself is the stub process. */ + if (its_me && myself->dwProcessId != GetCurrentProcessId ()) + { + wait_for_completion = false; + its_me = false; + } if (its_me) sendsig = my_sendsig;