summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index ee11d20e0..ba17f2308 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -136,6 +136,14 @@ status_exit (DWORD x)
# define self (*this)
void
+pinfo::set_exit_code (DWORD x)
+{
+ if (x >= 0xc0000000UL)
+ x = status_exit (x);
+ self->exitcode = EXITCODE_SET | (sigExeced ?: (x & 0xff) << 8);
+}
+
+void
pinfo::maybe_set_exit_code_from_windows ()
{
DWORD x = 0xdeadbeef;
@@ -147,9 +155,7 @@ pinfo::maybe_set_exit_code_from_windows ()
process hasn't quite exited
after closing pipe */
GetExitCodeProcess (hProcess, &x);
- if (x >= 0xc0000000UL)
- x = status_exit (x);
- self->exitcode = EXITCODE_SET | (sigExeced ?: (x & 0xff) << 8);
+ set_exit_code (x);
}
sigproc_printf ("pid %d, exit value - old %p, windows %p, cygwin %p",
self->pid, oexitcode, x, self->exitcode);