mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-18 23:12:15 +08:00
* 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.
This commit is contained in:
parent
a7ff2096f7
commit
9bf7c7e96c
@ -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.
|
||||
|
@ -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}}}
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 ())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user