From 10822894db3c3266edf4a2c5417c71bc6a324145 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Aug 2013 09:29:25 +0000 Subject: [PATCH] * path.h (enum path_types): Drop definition of PATH_64BITEXEC. (path_conv::iscygexec32): Drop unused inline function. (path_conv::iscygexec64): Ditto. (path_conv::set_cygexec): Remove unnecessary setting of PATH_64BITEXEC. * spawn.cc (child_info_spawn::worker): Disable setting of STARTUPINFOW::lpReserved2 and STARTUPINFOW::cbReserved2 for non-Cygwin child processes. Explain why. --- winsup/cygwin/ChangeLog | 10 ++++++++++ winsup/cygwin/path.h | 15 ++------------- winsup/cygwin/spawn.cc | 13 +++++++++++-- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b42a8c641..24622e6d8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2013-08-23 Corinna Vinschen + + * path.h (enum path_types): Drop definition of PATH_64BITEXEC. + (path_conv::iscygexec32): Drop unused inline function. + (path_conv::iscygexec64): Ditto. + (path_conv::set_cygexec): Remove unnecessary setting of PATH_64BITEXEC. + * spawn.cc (child_info_spawn::worker): Disable setting of + STARTUPINFOW::lpReserved2 and STARTUPINFOW::cbReserved2 for non-Cygwin + child processes. Explain why. + 2013-08-21 Corinna Vinschen * fhandler_tape.cc (mtinfo_drive::create_partitions): Allow partitioning diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 090754a02..d6c386075 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -87,8 +87,7 @@ enum path_types PATH_TEXT = 0x02000000, PATH_REP = 0x04000000, PATH_HAS_SYMLINKS = 0x10000000, - PATH_SOCKET = 0x40000000, - PATH_64BITEXEC = 0x80000000 + PATH_SOCKET = 0x40000000 }; class symlink_info; @@ -190,12 +189,6 @@ class path_conv int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();} int issocket () const {return dev.is_device (FH_UNIX);} int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;} - int iscygexec32 () const - {return (path_flags & (PATH_CYGWIN_EXEC | PATH_64BITEXEC)) - == PATH_CYGWIN_EXEC;} - int iscygexec64 () const - {return (path_flags & (PATH_CYGWIN_EXEC | PATH_64BITEXEC)) - == (PATH_CYGWIN_EXEC | PATH_64BITEXEC);} int isopen () const {return path_flags & PATH_OPEN;} int isctty_capable () const {return path_flags & PATH_CTTY;} void set_cygexec (bool isset) @@ -208,11 +201,7 @@ class path_conv void set_cygexec (void *target) { if (target) - { - path_flags |= PATH_CYGWIN_EXEC; - if (target == (void *) 64) - path_flags |= PATH_64BITEXEC; - } + path_flags |= PATH_CYGWIN_EXEC; else path_flags &= ~PATH_CYGWIN_EXEC; } diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 74c5fa40c..bd0ec177f 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -554,8 +554,17 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, __stdout = in__stdout; record_children (); - si.lpReserved2 = (LPBYTE) this; - si.cbReserved2 = sizeof (*this); + /* Don't propagate the child_info_spawn structure to the process if it + hasn't been recognized as a Cygwin executable. This also covers Cygwin + executables of a different target (32 vs. 64 bit). Native processes + usually still work, even if lpReserved2 contains garbage from their + point of view, but Cygwin processes of different bitsize will recognize + it as Cygwin info and get all excited about the differences. */ + if (real_path.iscygexec ()) + { + si.lpReserved2 = (LPBYTE) this; + si.cbReserved2 = sizeof (*this); + } /* Depends on set call above. Some file types might need extra effort in the parent after CreateProcess -- 2.43.5