Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-04-13 20:47:21 +0400
committerCorinna Vinschen <corinna@vinschen.de>2008-04-13 20:47:21 +0400
commit9bf7c7e96cf97fb10054775cfc84a92b4f45dea0 (patch)
treed528c007b7748d18400c7cec4ee9fa20665e9f9d /winsup
parenta7ff2096f7f5ca58a2ea202033a579675e695199 (diff)
* 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.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog16
-rw-r--r--winsup/cygwin/environ.cc1
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc26
-rw-r--r--winsup/cygwin/fhandler_process.cc15
-rw-r--r--winsup/cygwin/path.cc14
-rw-r--r--winsup/cygwin/syscalls.cc13
6 files changed, 40 insertions, 45 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1875ede01..2ce01ea67 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,19 @@
+2008-04-13 Corinna Vinschen <corinna@vinschen.de>
+
+ * 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.
+
2008-04-10 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (wprintf): Remove.
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index ab068ac25..ae202cf90 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -626,7 +626,6 @@ static struct parse_thing
{"title", {&display_title}, justset, NULL, {{false}, {true}}},
{"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}},
{"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}},
- {"transparent_exe", {&transparent_exe}, justset, NULL, {{false}, {true}}},
{NULL, {0}, justset, 0, {{0}, {0}}}
};
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 <winioctl.h>
#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);
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index a752bfb1c..b64f22175 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -446,17 +446,12 @@ fhandler_process::fill_filebuf ()
else
{
mount_table->conv_to_posix_path (p->progname, filebuf, 1);
- /* If transparent_exe isn't set, the link keeps its suffix so that
- an open(2) call will succeed on /proc/$PID/exe. */
- if (transparent_exe)
+ int len = strlen (filebuf);
+ if (len > 4)
{
- int len = strlen (filebuf);
- if (len > 4)
- {
- char *s = filebuf + len - 4;
- if (ascii_strcasematch (s, ".exe"))
- *s = 0;
- }
+ char *s = filebuf + len - 4;
+ if (ascii_strcasematch (s, ".exe"))
+ *s = 0;
}
}
filesize = strlen (filebuf);
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 0b94890b1..c44a932cb 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2872,25 +2872,13 @@ realpath (const char *path, char *resolved)
if (!real_path.error && real_path.exists ())
{
- /* Check for the suffix being tacked on. */
- int tack_on = 0;
- if (!transparent_exe && real_path.known_suffix)
- {
- char *c = strrchr (real_path.normalized_path, '.');
- if (!c || !ascii_strcasematch (c, real_path.known_suffix))
- tack_on = strlen (real_path.known_suffix);
- }
-
if (!resolved)
{
- resolved = (char *) malloc (strlen (real_path.normalized_path)
- + tack_on + 1);
+ resolved = (char *) malloc (strlen (real_path.normalized_path) + 1);
if (!resolved)
return NULL;
}
strcpy (resolved, real_path.normalized_path);
- if (tack_on)
- strcat (resolved, real_path.known_suffix);
return resolved;
}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 881b9d1eb..28533a58b 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -78,8 +78,6 @@ suffix_info stat_suffixes[] =
suffix_info (NULL)
};
-bool transparent_exe = false;
-
SYSTEM_INFO system_info;
static int __stdcall mknod_worker (const char *, mode_t, mode_t, _major_t,
@@ -517,8 +515,7 @@ unlink (const char *ourname)
DWORD devn;
NTSTATUS status;
- path_conv win32_name (ourname, PC_SYM_NOFOLLOW,
- transparent_exe ? stat_suffixes : NULL);
+ path_conv win32_name (ourname, PC_SYM_NOFOLLOW, stat_suffixes);
if (win32_name.error)
{
@@ -885,7 +882,7 @@ open (const char *unix_path, int flags, ...)
if (!(fh = build_fh_name (unix_path, NULL,
(flags & (O_NOFOLLOW | O_EXCL))
? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW,
- transparent_exe ? stat_suffixes : NULL)))
+ stat_suffixes)))
res = -1; // errno already set
else if ((flags & O_NOFOLLOW) && fh->issymlink ())
{
@@ -1010,8 +1007,7 @@ link (const char *oldpath, const char *newpath)
int res = -1;
fhandler_base *fh;
- if (!(fh = build_fh_name (oldpath, NULL, PC_SYM_NOFOLLOW,
- transparent_exe ? stat_suffixes : NULL)))
+ if (!(fh = build_fh_name (oldpath, NULL, PC_SYM_NOFOLLOW, stat_suffixes)))
goto error;
if (fh->error ())
@@ -1903,8 +1899,7 @@ pathconf (const char *file, int v)
set_errno (ENOENT);
return -1;
}
- if (!(fh = build_fh_name (file, NULL, PC_SYM_FOLLOW,
- transparent_exe ? stat_suffixes : NULL)))
+ if (!(fh = build_fh_name (file, NULL, PC_SYM_FOLLOW, stat_suffixes)))
return -1;
if (!fh->exists ())
{