diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/winf.h | 10 |
3 files changed, 12 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e3a4257dd..b493bdc99 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,13 @@ 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 only thing in the buffer is the program name. diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 23217401c..7682c3b9e 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -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 */ diff --git a/winsup/cygwin/winf.h b/winsup/cygwin/winf.h index d7488c360..ca7d2bdd9 100644 --- a/winsup/cygwin/winf.h +++ b/winsup/cygwin/winf.h @@ -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; \ -}) |