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>2013-07-19 21:28:34 +0400
committerChristopher Faylor <me@cgf.cx>2013-07-19 21:28:34 +0400
commit521953a83a885011c9040b635a94db5eb6b8db56 (patch)
tree1aa05b8b65b691cb4c5dccab65c4864d5e95cb54 /winsup/cygwin/spawn.cc
parent4b25516b5d410c38554c9595bcb674356ffee713 (diff)
* common.din: Export GetCommandLine{A,W}.
* kernel32.cc: Add includes needed for GetCommandLine functions. (ucmd): New function. (cygwin_GetCommandLineW): Ditto. (cygwin_GetCommandLineA): Ditto. * spawn.cc (child_info_spawn::worker): Rename one_line -> cmd. Use lb_wcs macro to generate a wide character version of the line buffer. Remove duplicate printing of command line. Don't access members of linebuf directly. * winf.h: Use pragma once. (linebuf): Make storage private. (linebuf::operator size_t): New operator. Return size of buf. (linebuf::operator wchar_t): New operator. (linebuf::wcs): New function. (lb_wcs): New macro. * include/cygwin/version.h: Bump API minor number to 268. * strfuncs.cc: Clarify descriptive file comment.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc33
1 files changed, 13 insertions, 20 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index b2e1c04bd..23217401c 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -319,7 +319,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
}
av newargv;
- linebuf one_line;
+ linebuf cmd;
PWCHAR envblock = NULL;
path_conv real_path;
bool reset_sendsig = false;
@@ -387,16 +387,16 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
(iscmd (argv[0], "command.com") || iscmd (argv[0], "cmd.exe")))
{
real_path.check (prog_arg);
- one_line.add ("\"");
+ cmd.add ("\"");
if (!real_path.error)
- one_line.add (real_path.get_win32 ());
+ cmd.add (real_path.get_win32 ());
else
- one_line.add (argv[0]);
- one_line.add ("\"");
- one_line.add (" ");
- one_line.add (argv[1]);
- one_line.add (" ");
- one_line.add (argv[2]);
+ cmd.add (argv[0]);
+ cmd.add ("\"");
+ cmd.add (" ");
+ cmd.add (argv[1]);
+ cmd.add (" ");
+ cmd.add (argv[2]);
real_path.set_path (argv[0]);
null_app_name = true;
}
@@ -407,7 +407,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
moreinfo->argc = newargv.argc;
moreinfo->argv = newargv;
}
- else if (!one_line.fromargv (newargv, real_path.get_win32 (),
+ else if (!cmd.fromargv (newargv, real_path.get_win32 (),
real_path.iscygexec ()))
{
res = -1;
@@ -423,11 +423,6 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
else
VerifyHandle (moreinfo->myself_pinfo);
}
- WCHAR wone_line[one_line.ix + 1];
- if (one_line.ix)
- sys_mbstowcs (wone_line, one_line.ix + 1, one_line.buf);
- else
- wone_line[0] = L'\0';
PROCESS_INFORMATION pi;
pi.hProcess = pi.hThread = NULL;
@@ -539,8 +534,6 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
goto out;
}
}
- syscall_printf ("null_app_name %d (%W, %.9500W)", null_app_name,
- runpath, wone_line);
cygbench ("spawn-worker");
@@ -626,7 +619,7 @@ loop:
&& !::cygheap->user.setuid_to_restricted))
{
rc = CreateProcessW (runpath, /* image name - with full path */
- wone_line, /* what was passed to exec */
+ lb_wcs (cmd), /* what was passed to exec */
&sec_none_nih, /* process security attrs */
&sec_none_nih, /* thread security attrs */
TRUE, /* inherit handles from parent */
@@ -689,7 +682,7 @@ loop:
rc = CreateProcessAsUserW (::cygheap->user.primary_token (),
runpath, /* image name - with full path */
- wone_line, /* what was passed to exec */
+ lb_wcs (cmd), /* what was passed to exec */
&sec_none_nih, /* process security attrs */
&sec_none_nih, /* thread security attrs */
TRUE, /* inherit handles from parent */
@@ -763,7 +756,7 @@ loop:
/* We print the original program name here so the user can see that too. */
syscall_printf ("pid %d, prog_arg %s, cmd line %.9500s)",
- rc ? cygpid : (unsigned int) -1, prog_arg, one_line.buf);
+ rc ? cygpid : (unsigned int) -1, prog_arg, (const char *) cmd);
/* Name the handle similarly to proc_subproc. */
ProtectHandle1 (pi.hProcess, childhProc);