Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-03-27 04:50:40 +0300
committerChristopher Faylor <me@cgf.cx>2008-03-27 04:50:40 +0300
commit93d606f60aed779c555017828656c8a4e3c9c6a9 (patch)
treea1064ee801fa9606f9c06a4dc7f03f79db0314d9 /winsup/cygwin/pinfo.cc
parent73de02f44b83eeccdacf7b803cc37074660f75b2 (diff)
* hookapi.cc (find_first_notloaded_dll): New function.
* pinfo.cc (status_exit): New function. Issue message when dll not found. Use find_first_notloaded_dll to find a nonexistent dll. (pinfo::maybe_set_exit_code_from_windows): Call status_exit when exit code >= 0xc0000000UL. * sigproc.cc (child_info::proc_retry): Return exit code when STATUS_DLL_NOT_FOUND. * spawn.cc (spawn_guts): Minor cleanup. * syscalls.cc (close_all_files): Don't actually close stderr filehandle. Just make it noninheritable. * winsup.h (find_first_notloaded_dll): Declare new function. * ntdll.h: Add several missing NTSTATUS defines.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc30
1 files changed, 27 insertions, 3 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 85fdf9b37..d6b5de527 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -104,6 +104,28 @@ pinfo_init (char **envp, int envc)
debug_printf ("pid %d, pgid %d", myself->pid, myself->pgid);
}
+static DWORD
+status_exit (DWORD x)
+{
+ const char *find_first_notloaded_dll (path_conv &);
+ switch (x)
+ {
+ case STATUS_DLL_NOT_FOUND:
+ {
+ char posix_prog[NT_MAX_PATH];
+ path_conv pc (myself->progname, PC_NOWARN);
+ mount_table->conv_to_posix_path (pc.get_win32 (), posix_prog, 1);
+ small_printf ("%s: error while loading shared libraries: %s: cannot open shared object file: No such file or directory\n",
+ posix_prog, find_first_notloaded_dll (pc));
+ x = 127;
+ }
+ break;
+ default:
+ x = 127;
+ }
+ return x;
+}
+
# define self (*this)
void
pinfo::maybe_set_exit_code_from_windows ()
@@ -114,10 +136,12 @@ pinfo::maybe_set_exit_code_from_windows ()
if (hProcess && !(self->exitcode & EXITCODE_SET))
{
- WaitForSingleObject (hProcess, INFINITE); // just to be safe, in case
- // process hasn't quite exited
- // after closing pipe
+ WaitForSingleObject (hProcess, INFINITE); /* just to be safe, in case
+ 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);
}
sigproc_printf ("pid %d, exit value - old %p, windows %p, cygwin %p",