[newlib-cygwin/cygwin-3_3-branch] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.

Takashi Yano tyan0@sourceware.org
Fri Feb 25 08:32:01 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cb9e68fd9be4fdec25dd340cb94f442c9848f2f2

commit cb9e68fd9be4fdec25dd340cb94f442c9848f2f2
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Thu Feb 24 21:04:49 2022 +0900

    Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.
    
    - Previously, if non-cygwin app exits by Ctrl-C, exit code was
      0x00007f00. With this patch, the exit code will be 0x00000002,
      which means process exited by SIGINT.

Diff:
---
 winsup/cygwin/pinfo.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index bce743bfc..bb7c16547 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -156,6 +156,9 @@ pinfo::status_exit (DWORD x)
 	 a lengthy small_printf instead. */
       x = SIGBUS;
       break;
+    case STATUS_CONTROL_C_EXIT:
+      x = SIGINT;
+      break;
     default:
       debug_printf ("*** STATUS_%y\n", x);
       x = 127 << 8;


More information about the Cygwin-cvs mailing list