From 9bf7c7e96cf97fb10054775cfc84a92b4f45dea0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 13 Apr 2008 16:47:21 +0000 Subject: * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Simplify code which checks for symlinks. Fix problem with UNC paths. * environ.cc (struct parse_thing): Remove transparent_exe option. * syscalls.cc (transparent_exe): Remove. (unlink): Always add stat_suffixes, drop transparent_exe check. (open): Ditto. (link): Ditto. (pathconf): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::link): Ditto. * fhandler_process.cc (fhandler_process::fill_filebuf): Always remove .exe suffix. * path.cc (realpath): Never attach known_suffix. --- winsup/cygwin/fhandler_disk_file.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'winsup/cygwin/fhandler_disk_file.cc') diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 112ad9c1d..0f400bbe8 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -22,6 +22,7 @@ details. */ #include "shared_info.h" #include "pinfo.h" #include "ntdll.h" +#include "tls_pbuf.h" #include #define _COMPILING_NEWLIB @@ -1063,8 +1064,7 @@ fhandler_disk_file::link (const char *newpath) { extern bool allow_winsymlinks; - path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_POSIX, - transparent_exe ? stat_suffixes : NULL); + path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes); if (newpc.error) { set_errno (newpc.case_clash ? ECASECLASH : newpc.error); @@ -1607,21 +1607,23 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err, fname->Buffer + fname->Length / sizeof (WCHAR) - 4, 4 * sizeof (WCHAR)); - RtlInitCountedUnicodeString (&lname, (PWCHAR) L".lnk", - 4 * sizeof (WCHAR)); - + RtlInitUnicodeString (&lname, (PWCHAR) L".lnk"); if (RtlEqualUnicodeString (&uname, &lname, TRUE)) { - UNICODE_STRING dirname = *pc.get_nt_native_path (); - dirname.Buffer += 4; /* Skip leading \??\ */ - dirname.Length -= 4 * sizeof (WCHAR); + tmp_pathbuf tp; UNICODE_STRING fbuf; - ULONG len = dirname.Length + fname->Length + 2 * sizeof (WCHAR); - - RtlInitEmptyUnicodeString (&fbuf, (PCWSTR) alloca (len), len); - RtlCopyUnicodeString (&fbuf, &dirname); + + tp.u_get (&fbuf); + RtlCopyUnicodeString (&fbuf, pc.get_nt_native_path ()); RtlAppendUnicodeToString (&fbuf, L"\\"); RtlAppendUnicodeStringToString (&fbuf, fname); + fbuf.Buffer += 4; /* Skip leading \??\ */ + fbuf.Length -= 4 * sizeof (WCHAR); + if (*fbuf.Buffer == L'U') /* UNC path */ + { + *(fbuf.Buffer += 2) = L'\\'; + fbuf.Length -= 2 * sizeof (WCHAR); + } path_conv fpath (&fbuf, PC_SYM_NOFOLLOW); if (fpath.issymlink () || fpath.is_fs_special ()) fname->Length -= 4 * sizeof (WCHAR); -- cgit v1.2.3