summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index f90ffbcea..0a94282f0 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -472,6 +472,20 @@ spawn_guts (const char *prog_arg, const char *const *argv,
}
runpath = null_app_name ? NULL : real_path.get_wide_win32_path (runpath);
+ { /* If the executable path length is < MAX_PATH, make sure the long path
+ win32 prefix is removed from the path to make subsequent native Win32
+ child processes happy which are not long path aware. */
+ USHORT len = real_path.get_nt_native_path ()->Length;
+ if (len < (MAX_PATH + 4) * sizeof (WCHAR)
+ || (runpath[5] != L':' /* UNC path */
+ && len < (MAX_PATH + 6) * sizeof (WCHAR)))
+ {
+ PWCHAR r = runpath + 4;
+ if (r[1] != L':') /* UNC path */
+ r += 2;
+ runpath = r;
+ }
+ }
syscall_printf ("null_app_name %d (%W, %.9500W)", null_app_name,
runpath, wone_line);