From 6c968f611bfa7045711f9844de2a5129257fbc1a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 11 Mar 2008 12:34:08 +0000 Subject: * path.cc (cwdstuff::set): Make sure drive_length is 0 for virtual paths. Add comments. * spawn.cc (spawn_guts): Don't allow to start a native Win32 application from a long path or a virtual path. Print an error message to stderr. --- winsup/cygwin/spawn.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'winsup/cygwin/spawn.cc') diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 4ea04d934..9d6b25261 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -361,6 +361,21 @@ spawn_guts (const char * prog_arg, const char *const *argv, wascygexec = real_path.iscygexec (); res = newargv.fixup (prog_arg, real_path, ext); + + if (!real_path.iscygexec () + && (cygheap->cwd.drive_length == 0 + || cygheap->cwd.win32.Length >= MAX_PATH * sizeof (WCHAR))) + { + small_printf ("Error: Current working directory is a %s.\n" + "Can't start native Windows application from here.\n\n", + cygheap->cwd.drive_length == 0 + ? "virtual Cygwin directory" + : "path longer than allowed for a\n" + "Win32 working directory"); + set_errno (ENAMETOOLONG); + res = -1; + goto out; + } if (res) goto out; -- cgit v1.2.3