summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-12-27 00:35:19 +0000
committerChristopher Faylor <me@cgf.cx>2004-12-27 00:35:19 +0000
commit445d5ce8fcffed71f4349c723b707dc779fe1cc2 (patch)
treedd0a5b737917fddf83d4a9a38b947126cf8ddfad /winsup/cygwin/pinfo.cc
parent8711eddd80efc5f05f19da613ce3ad7ebc66aa35 (diff)
downloadcygnal-445d5ce8fcffed71f4349c723b707dc779fe1cc2.tar.gz
cygnal-445d5ce8fcffed71f4349c723b707dc779fe1cc2.tar.bz2
cygnal-445d5ce8fcffed71f4349c723b707dc779fe1cc2.zip
* init.cc (dll_entry): Remove exit code setting.
* pinfo.cc (pinfo::init): Initialize exitcode to unset state rather than SIGTERM. (proc_waiter): Detect if exit code is unset and use status from GetExitCodeProcess. * sigproc.cc (child_info::sync): Remove exit code detection here since proc_waiter now (again) detects it.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 1bf6b5ea3..24167b90d 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -265,7 +265,7 @@ pinfo::init (pid_t n, DWORD flag, HANDLE in_h)
else if (!(flag & PID_EXECED))
{
procinfo->pid = n;
- procinfo->exitcode = SIGTERM;
+ procinfo->exitcode = EXITCODE_UNSET;
}
else
{
@@ -702,6 +702,12 @@ proc_waiter (void *arg)
/* Child exited. Do some cleanup and signal myself. */
CloseHandle (vchild.rd_proc_pipe);
vchild.rd_proc_pipe = NULL;
+ if (vchild->exitcode == EXITCODE_UNSET)
+ {
+ DWORD x;
+ GetExitCodeProcess (vchild.hProcess, &x);
+ vchild->exitcode = (x & 0xff) << 8;
+ }
if (WIFEXITED (vchild->exitcode))
si.si_sigval.sival_int = CLD_EXITED;
else if (WCOREDUMP (vchild->exitcode))