* 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>
|
2008-04-10 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cygwin.din (wprintf): Remove.
|
* cygwin.din (wprintf): Remove.
|
||||||
|
|
|
@ -626,7 +626,6 @@ static struct parse_thing
|
||||||
{"title", {&display_title}, justset, NULL, {{false}, {true}}},
|
{"title", {&display_title}, justset, NULL, {{false}, {true}}},
|
||||||
{"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}},
|
{"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}},
|
||||||
{"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}},
|
{"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}},
|
||||||
{"transparent_exe", {&transparent_exe}, justset, NULL, {{false}, {true}}},
|
|
||||||
{NULL, {0}, justset, 0, {{0}, {0}}}
|
{NULL, {0}, justset, 0, {{0}, {0}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ details. */
|
||||||
#include "shared_info.h"
|
#include "shared_info.h"
|
||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
#include "tls_pbuf.h"
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
|
|
||||||
#define _COMPILING_NEWLIB
|
#define _COMPILING_NEWLIB
|
||||||
|
@ -1063,8 +1064,7 @@ fhandler_disk_file::link (const char *newpath)
|
||||||
{
|
{
|
||||||
extern bool allow_winsymlinks;
|
extern bool allow_winsymlinks;
|
||||||
|
|
||||||
path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_POSIX,
|
path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes);
|
||||||
transparent_exe ? stat_suffixes : NULL);
|
|
||||||
if (newpc.error)
|
if (newpc.error)
|
||||||
{
|
{
|
||||||
set_errno (newpc.case_clash ? ECASECLASH : 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->Buffer
|
||||||
+ fname->Length / sizeof (WCHAR) - 4,
|
+ fname->Length / sizeof (WCHAR) - 4,
|
||||||
4 * sizeof (WCHAR));
|
4 * sizeof (WCHAR));
|
||||||
RtlInitCountedUnicodeString (&lname, (PWCHAR) L".lnk",
|
RtlInitUnicodeString (&lname, (PWCHAR) L".lnk");
|
||||||
4 * sizeof (WCHAR));
|
|
||||||
|
|
||||||
if (RtlEqualUnicodeString (&uname, &lname, TRUE))
|
if (RtlEqualUnicodeString (&uname, &lname, TRUE))
|
||||||
{
|
{
|
||||||
UNICODE_STRING dirname = *pc.get_nt_native_path ();
|
tmp_pathbuf tp;
|
||||||
dirname.Buffer += 4; /* Skip leading \??\ */
|
|
||||||
dirname.Length -= 4 * sizeof (WCHAR);
|
|
||||||
UNICODE_STRING fbuf;
|
UNICODE_STRING fbuf;
|
||||||
ULONG len = dirname.Length + fname->Length + 2 * sizeof (WCHAR);
|
|
||||||
|
|
||||||
RtlInitEmptyUnicodeString (&fbuf, (PCWSTR) alloca (len), len);
|
tp.u_get (&fbuf);
|
||||||
RtlCopyUnicodeString (&fbuf, &dirname);
|
RtlCopyUnicodeString (&fbuf, pc.get_nt_native_path ());
|
||||||
RtlAppendUnicodeToString (&fbuf, L"\\");
|
RtlAppendUnicodeToString (&fbuf, L"\\");
|
||||||
RtlAppendUnicodeStringToString (&fbuf, fname);
|
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);
|
path_conv fpath (&fbuf, PC_SYM_NOFOLLOW);
|
||||||
if (fpath.issymlink () || fpath.is_fs_special ())
|
if (fpath.issymlink () || fpath.is_fs_special ())
|
||||||
fname->Length -= 4 * sizeof (WCHAR);
|
fname->Length -= 4 * sizeof (WCHAR);
|
||||||
|
|
|
@ -446,10 +446,6 @@ fhandler_process::fill_filebuf ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mount_table->conv_to_posix_path (p->progname, filebuf, 1);
|
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);
|
int len = strlen (filebuf);
|
||||||
if (len > 4)
|
if (len > 4)
|
||||||
{
|
{
|
||||||
|
@ -458,7 +454,6 @@ fhandler_process::fill_filebuf ()
|
||||||
*s = 0;
|
*s = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
filesize = strlen (filebuf);
|
filesize = strlen (filebuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2872,25 +2872,13 @@ realpath (const char *path, char *resolved)
|
||||||
|
|
||||||
if (!real_path.error && real_path.exists ())
|
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)
|
if (!resolved)
|
||||||
{
|
{
|
||||||
resolved = (char *) malloc (strlen (real_path.normalized_path)
|
resolved = (char *) malloc (strlen (real_path.normalized_path) + 1);
|
||||||
+ tack_on + 1);
|
|
||||||
if (!resolved)
|
if (!resolved)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy (resolved, real_path.normalized_path);
|
strcpy (resolved, real_path.normalized_path);
|
||||||
if (tack_on)
|
|
||||||
strcat (resolved, real_path.known_suffix);
|
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,6 @@ suffix_info stat_suffixes[] =
|
||||||
suffix_info (NULL)
|
suffix_info (NULL)
|
||||||
};
|
};
|
||||||
|
|
||||||
bool transparent_exe = false;
|
|
||||||
|
|
||||||
SYSTEM_INFO system_info;
|
SYSTEM_INFO system_info;
|
||||||
|
|
||||||
static int __stdcall mknod_worker (const char *, mode_t, mode_t, _major_t,
|
static int __stdcall mknod_worker (const char *, mode_t, mode_t, _major_t,
|
||||||
|
@ -517,8 +515,7 @@ unlink (const char *ourname)
|
||||||
DWORD devn;
|
DWORD devn;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
path_conv win32_name (ourname, PC_SYM_NOFOLLOW,
|
path_conv win32_name (ourname, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||||
transparent_exe ? stat_suffixes : NULL);
|
|
||||||
|
|
||||||
if (win32_name.error)
|
if (win32_name.error)
|
||||||
{
|
{
|
||||||
|
@ -885,7 +882,7 @@ open (const char *unix_path, int flags, ...)
|
||||||
if (!(fh = build_fh_name (unix_path, NULL,
|
if (!(fh = build_fh_name (unix_path, NULL,
|
||||||
(flags & (O_NOFOLLOW | O_EXCL))
|
(flags & (O_NOFOLLOW | O_EXCL))
|
||||||
? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW,
|
? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW,
|
||||||
transparent_exe ? stat_suffixes : NULL)))
|
stat_suffixes)))
|
||||||
res = -1; // errno already set
|
res = -1; // errno already set
|
||||||
else if ((flags & O_NOFOLLOW) && fh->issymlink ())
|
else if ((flags & O_NOFOLLOW) && fh->issymlink ())
|
||||||
{
|
{
|
||||||
|
@ -1010,8 +1007,7 @@ link (const char *oldpath, const char *newpath)
|
||||||
int res = -1;
|
int res = -1;
|
||||||
fhandler_base *fh;
|
fhandler_base *fh;
|
||||||
|
|
||||||
if (!(fh = build_fh_name (oldpath, NULL, PC_SYM_NOFOLLOW,
|
if (!(fh = build_fh_name (oldpath, NULL, PC_SYM_NOFOLLOW, stat_suffixes)))
|
||||||
transparent_exe ? stat_suffixes : NULL)))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (fh->error ())
|
if (fh->error ())
|
||||||
|
@ -1903,8 +1899,7 @@ pathconf (const char *file, int v)
|
||||||
set_errno (ENOENT);
|
set_errno (ENOENT);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(fh = build_fh_name (file, NULL, PC_SYM_FOLLOW,
|
if (!(fh = build_fh_name (file, NULL, PC_SYM_FOLLOW, stat_suffixes)))
|
||||||
transparent_exe ? stat_suffixes : NULL)))
|
|
||||||
return -1;
|
return -1;
|
||||||
if (!fh->exists ())
|
if (!fh->exists ())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue