summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-09-07 03:10:17 +0000
committerChristopher Faylor <me@cgf.cx>2005-09-07 03:10:17 +0000
commit41ff9d8c7d4f1224b594eee921b6a966a0585d72 (patch)
tree9a5f0e4545d151129fb93e3125addca8e0e6a8d9 /winsup/cygwin/spawn.cc
parente92fdf016331c18f76a2ccac28a58edf0e2f2685 (diff)
downloadcygnal-41ff9d8c7d4f1224b594eee921b6a966a0585d72.tar.gz
cygnal-41ff9d8c7d4f1224b594eee921b6a966a0585d72.tar.bz2
cygnal-41ff9d8c7d4f1224b594eee921b6a966a0585d72.zip
* dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.
(dll_crt0_0): Move console initialization earlier. * init.cc (dll_entry): Move console initialization here. * exceptions.cc (init_console_handler): Fully remove any old console handler. * spawn.cc (spawn_guts): Don't fill out windows argv if we've deduced that this is a cygwin-using program. (av::fixup): Always check executables to see if they are using cygwin1.dll. Don't consider .com files to be scripts. * hookapi.cc (rvadelta): New function. (PEHeaderFromHModule): Simplify slightly. (hook_or_detect_cygwin): Use passed in name argument for "HMODULE" rather than incorrectly reading current program. Calculate delta needed to read image data and file names if this isn't a real "HMODULE".
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index e2c3decf5..87b2b6dcb 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -279,7 +279,7 @@ class av
bool win16_exe;
bool iscygwin;
av (): argv (NULL) {}
- av (int ac_in, const char * const *av_in) : calloced (0), error (false), argc (ac_in), win16_exe (false), iscygwin (true)
+ av (int ac_in, const char * const *av_in) : calloced (0), error (false), argc (ac_in), win16_exe (false), iscygwin (false)
{
argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *));
memcpy (argv, av_in, (argc + 1) * sizeof (char *));
@@ -459,6 +459,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
one_line.add (argv[2]);
strcpy (real_path, argv[0]);
null_app_name = true;
+ newargv.iscygwin = false;
goto skip_arg_parsing;
}
@@ -476,7 +477,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
if (res)
goto out;
- if (real_path.iscygexec ())
+ if (real_path.iscygexec () || newargv.iscygwin)
newargv.dup_all ();
else
{
@@ -1020,9 +1021,7 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
{
/* If the file name ends in either .exe, .com, .bat, or .cmd we assume
that it is NOT a script file */
- while (*ext == '\0' || chtype == PROC_SPAWN
- || (wincap.detect_win16_exe () && (strcasematch (ext, ".exe")
- || strcasematch (ext, ".com"))))
+ while (1)
{
HANDLE h = CreateFile (real_path, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -1092,6 +1091,11 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
UnmapViewOfFile (buf);
if (!pgm)
{
+ if (strcasematch (ext, ".com"))
+ {
+ iscygwin = false;
+ break;
+ }
pgm = (char *) "/bin/sh";
arg1 = NULL;
}