* spawn.cc (spawn_guts): Reorganize slightly so that 16 bit check is done prior
to check for command.com/cmd.com. Don't bother setting CREATE_SUSPENDED flag for a MS-DOS process since it doesn't work anyway. Avoid calling remember() when the child process has already exited. (av::fixup): Explicitly set cygexec flag to falseon a 16 bit process.
This commit is contained in:
parent
e93a726084
commit
5da5f949d8
@ -1,3 +1,12 @@
|
|||||||
|
2006-01-09 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* spawn.cc (spawn_guts): Reorganize slightly so that 16 bit check is
|
||||||
|
done prior to check for command.com/cmd.com. Don't bother setting
|
||||||
|
CREATE_SUSPENDED flag for a MS-DOS process since it doesn't work
|
||||||
|
anyway. Avoid calling remember() when the child process has already
|
||||||
|
exited.
|
||||||
|
(av::fixup): Explicitly set cygexec flag to falseon a 16 bit process.
|
||||||
|
|
||||||
2006-01-09 Corinna Vinschen <corinna@vinschen.de>
|
2006-01-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* include/getopt.h (getopt_long_only): Declare.
|
* include/getopt.h (getopt_long_only): Declare.
|
||||||
|
@ -426,6 +426,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
linebuf one_line;
|
linebuf one_line;
|
||||||
child_info_spawn ch;
|
child_info_spawn ch;
|
||||||
|
|
||||||
|
char *envblock;
|
||||||
path_conv real_path;
|
path_conv real_path;
|
||||||
bool reset_sendsig = false;
|
bool reset_sendsig = false;
|
||||||
|
|
||||||
@ -461,6 +462,21 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
|
|
||||||
newargv.set (ac, argv);
|
newargv.set (ac, argv);
|
||||||
|
|
||||||
|
int err;
|
||||||
|
const char *ext;
|
||||||
|
if ((ext = perhaps_suffix (prog_arg, real_path, err)) == NULL)
|
||||||
|
{
|
||||||
|
set_errno (err);
|
||||||
|
res = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wascygexec = real_path.iscygexec ();
|
||||||
|
res = newargv.fixup (chtype, prog_arg, real_path, ext);
|
||||||
|
|
||||||
|
if (res)
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (ac == 3 && argv[1][0] == '/' && argv[1][1] == 'c' &&
|
if (ac == 3 && argv[1][0] == '/' && argv[1][1] == 'c' &&
|
||||||
(iscmd (argv[0], "command.com") || iscmd (argv[0], "cmd.exe")))
|
(iscmd (argv[0], "command.com") || iscmd (argv[0], "cmd.exe")))
|
||||||
{
|
{
|
||||||
@ -477,23 +493,9 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
one_line.add (argv[2]);
|
one_line.add (argv[2]);
|
||||||
strcpy (real_path, argv[0]);
|
strcpy (real_path, argv[0]);
|
||||||
null_app_name = true;
|
null_app_name = true;
|
||||||
goto skip_arg_parsing;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
int err;
|
|
||||||
const char *ext;
|
|
||||||
if ((ext = perhaps_suffix (prog_arg, real_path, err)) == NULL)
|
|
||||||
{
|
{
|
||||||
set_errno (err);
|
|
||||||
res = -1;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wascygexec = real_path.iscygexec ();
|
|
||||||
res = newargv.fixup (chtype, prog_arg, real_path, ext);
|
|
||||||
if (res)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (wascygexec)
|
if (wascygexec)
|
||||||
newargv.dup_all ();
|
newargv.dup_all ();
|
||||||
else
|
else
|
||||||
@ -555,7 +557,6 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *envblock;
|
|
||||||
newargv.all_calloced ();
|
newargv.all_calloced ();
|
||||||
moreinfo->argc = newargv.argc;
|
moreinfo->argc = newargv.argc;
|
||||||
moreinfo->argv = newargv;
|
moreinfo->argv = newargv;
|
||||||
@ -567,8 +568,8 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
moreinfo->myself_pinfo = NULL;
|
moreinfo->myself_pinfo = NULL;
|
||||||
else
|
else
|
||||||
VerifyHandle (moreinfo->myself_pinfo);
|
VerifyHandle (moreinfo->myself_pinfo);
|
||||||
|
}
|
||||||
|
|
||||||
skip_arg_parsing:
|
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
pi.hProcess = pi.hThread = NULL;
|
pi.hProcess = pi.hThread = NULL;
|
||||||
pi.dwProcessId = pi.dwThreadId = 0;
|
pi.dwProcessId = pi.dwThreadId = 0;
|
||||||
@ -624,8 +625,9 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
after CreateProcess and before copying the datastructures to the child.
|
after CreateProcess and before copying the datastructures to the child.
|
||||||
So we have to start the child in suspend state, unfortunately, to avoid
|
So we have to start the child in suspend state, unfortunately, to avoid
|
||||||
a race condition. */
|
a race condition. */
|
||||||
if (wincap.start_proc_suspended () || mode != _P_OVERLAY
|
if (!newargv.win16_exe
|
||||||
|| cygheap->fdtab.need_fixup_before ())
|
&& (wincap.start_proc_suspended () || mode != _P_OVERLAY
|
||||||
|
|| cygheap->fdtab.need_fixup_before ()))
|
||||||
flags |= CREATE_SUSPENDED;
|
flags |= CREATE_SUSPENDED;
|
||||||
|
|
||||||
const char *runpath = null_app_name ? NULL : (const char *) real_path;
|
const char *runpath = null_app_name ? NULL : (const char *) real_path;
|
||||||
@ -836,7 +838,8 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
{
|
{
|
||||||
case _P_OVERLAY:
|
case _P_OVERLAY:
|
||||||
myself.hProcess = pi.hProcess;
|
myself.hProcess = pi.hProcess;
|
||||||
if (synced && !myself->wr_proc_pipe)
|
if (synced && WaitForSingleObject (pi.hProcess, 0) == WAIT_TIMEOUT
|
||||||
|
&& !myself->wr_proc_pipe)
|
||||||
{
|
{
|
||||||
extern bool is_toplevel_proc;
|
extern bool is_toplevel_proc;
|
||||||
is_toplevel_proc = true;
|
is_toplevel_proc = true;
|
||||||
@ -1078,6 +1081,8 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
|
|||||||
win16_exe = off < sizeof (IMAGE_DOS_HEADER);
|
win16_exe = off < sizeof (IMAGE_DOS_HEADER);
|
||||||
if (!win16_exe)
|
if (!win16_exe)
|
||||||
real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL, subsys));
|
real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL, subsys));
|
||||||
|
else
|
||||||
|
real_path.set_cygexec (false);
|
||||||
UnmapViewOfFile (buf);
|
UnmapViewOfFile (buf);
|
||||||
iscui = subsys == IMAGE_SUBSYSTEM_WINDOWS_CUI;
|
iscui = subsys == IMAGE_SUBSYSTEM_WINDOWS_CUI;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user