* spawn.cc (child_info_spawn::worker): Reinstate using temp buffer for wide

character command-line storage.  Use wcs method to convert command line.
* winf.h (lb_wcs): Delete.
(linebuf::wcs): Implement new single-argument method.
This commit is contained in:
Christopher Faylor 2013-07-19 22:44:02 +00:00
parent 132e0f0182
commit bbdd6c47c9
3 changed files with 12 additions and 11 deletions

View File

@ -1,3 +1,11 @@
2013-07-19 Christopher Faylor <me.cygwin2013@cgf.cx>
* spawn.cc (child_info_spawn::worker): Reinstate using temp buffer for
wide character command-line storage. Use wcs method to convert command
line.
* winf.h (lb_wcs): Delete.
(linebuf::wcs): Implement new single-argument method.
2013-07-19 Christopher Faylor <me.cygwin2013@cgf.cx>
* lib/libcmain.c (main): Don't point to last quoted character if the

View File

@ -612,6 +612,7 @@ loop:
if (!real_path.iscygexec () && mode == _P_OVERLAY)
myself->process_state |= PID_NOTCYGWIN;
wchar_t wcmd[(size_t) cmd];
if (!::cygheap->user.issetuid ()
|| (::cygheap->user.saved_uid == ::cygheap->user.real_uid
&& ::cygheap->user.saved_gid == ::cygheap->user.real_gid
@ -619,7 +620,7 @@ loop:
&& !::cygheap->user.setuid_to_restricted))
{
rc = CreateProcessW (runpath, /* image name - with full path */
lb_wcs (cmd), /* what was passed to exec */
cmd.wcs (wcmd),/* what was passed to exec */
&sec_none_nih, /* process security attrs */
&sec_none_nih, /* thread security attrs */
TRUE, /* inherit handles from parent */
@ -682,7 +683,7 @@ loop:
rc = CreateProcessAsUserW (::cygheap->user.primary_token (),
runpath, /* image name - with full path */
lb_wcs (cmd), /* what was passed to exec */
cmd.wcs (wcmd),/* what was passed to exec */
&sec_none_nih, /* process security attrs */
&sec_none_nih, /* thread security attrs */
TRUE, /* inherit handles from parent */

View File

@ -86,6 +86,7 @@ class linebuf
wchar_t *wbuf = (wchar_t *) malloc (sizeof (wchar_t) * n);
return wcs (wbuf, n);
}
wchar_t *wcs (wchar_t *wbuf) { return wcs (wbuf, ix + 1); }
wchar_t *wcs (wchar_t *wbuf, size_t n)
{
if (n == 1)
@ -95,12 +96,3 @@ class linebuf
return wbuf;
}
};
/* Return a temporary buffer representing the wide character version
of a linebuf command line. */
#define lb_wcs(__x) \
({ \
wchar_t __wbuf[(size_t) __x]; \
__x.wcs (__wbuf, sizeof (__wbuf) / sizeof (__wbuf[0])); \
__wbuf; \
})