mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-19 07:22:14 +08:00
* fhandler_disk_file.cc (__DIR_mounts::eval_ino): Create path_conv
with PC_KEEP_HANDLE flag. * path.h (path_conv::operator =): Duplicate UNICODE path as well. * security.cc (check_file_access): Use path_conv handle if available. * syscalls.cc (access): Create fhandler with PC_KEEP_HANDLE flag set. (euidaccess): Ditto. (faccessat): Ditto.
This commit is contained in:
parent
f4529884e5
commit
303dc0230d
@ -1,3 +1,13 @@
|
||||
2011-07-26 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_disk_file.cc (__DIR_mounts::eval_ino): Create path_conv
|
||||
with PC_KEEP_HANDLE flag.
|
||||
* path.h (path_conv::operator =): Duplicate UNICODE path as well.
|
||||
* security.cc (check_file_access): Use path_conv handle if available.
|
||||
* syscalls.cc (access): Create fhandler with PC_KEEP_HANDLE flag set.
|
||||
(euidaccess): Ditto.
|
||||
(faccessat): Ditto.
|
||||
|
||||
2011-07-26 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* ntdll.h: Fix typo in comment.
|
||||
|
@ -52,7 +52,7 @@ class __DIR_mounts
|
||||
*c++ = '/';
|
||||
sys_wcstombs (c, mounts[idx].Length + 1,
|
||||
mounts[idx].Buffer, mounts[idx].Length / sizeof (WCHAR));
|
||||
path_conv pc (fname, PC_SYM_NOFOLLOW | PC_POSIX);
|
||||
path_conv pc (fname, PC_SYM_NOFOLLOW | PC_POSIX | PC_KEEP_HANDLE);
|
||||
if (!stat_worker (pc, &st))
|
||||
ino = st.st_ino;
|
||||
return ino;
|
||||
|
@ -282,7 +282,13 @@ class path_conv
|
||||
path = cstrdup (pc.path);
|
||||
conv_handle.dup (pc.conv_handle);
|
||||
normalized_path = cstrdup(pc.normalized_path);
|
||||
wide_path = NULL;
|
||||
if (pc.wide_path)
|
||||
{
|
||||
wide_path = cwcsdup (uni_path.Buffer);
|
||||
if (!wide_path)
|
||||
api_fatal ("cwcsdup would have returned NULL");
|
||||
uni_path.Buffer = wide_path;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
void free_strings ()
|
||||
|
@ -1063,7 +1063,7 @@ check_file_access (path_conv &pc, int flags, bool effective)
|
||||
desired |= FILE_WRITE_DATA;
|
||||
if (flags & X_OK)
|
||||
desired |= FILE_EXECUTE;
|
||||
if (!get_file_sd (NULL, pc, sd, false))
|
||||
if (!get_file_sd (pc.handle (), pc, sd, false))
|
||||
ret = check_access (sd, file_mapping, desired, flags, effective);
|
||||
debug_printf ("flags %x, ret %d", flags, ret);
|
||||
return ret;
|
||||
|
@ -1677,7 +1677,8 @@ access (const char *fn, int flags)
|
||||
set_errno (EINVAL);
|
||||
else
|
||||
{
|
||||
fhandler_base *fh = build_fh_name (fn, PC_SYM_FOLLOW, stat_suffixes);
|
||||
fhandler_base *fh = build_fh_name (fn, PC_SYM_FOLLOW | PC_KEEP_HANDLE,
|
||||
stat_suffixes);
|
||||
if (fh)
|
||||
{
|
||||
res = fh->fhaccess (flags, false);
|
||||
@ -1700,7 +1701,8 @@ euidaccess (const char *fn, int flags)
|
||||
set_errno (EINVAL);
|
||||
else
|
||||
{
|
||||
fhandler_base *fh = build_fh_name (fn, PC_SYM_FOLLOW, stat_suffixes);
|
||||
fhandler_base *fh = build_fh_name (fn, PC_SYM_FOLLOW | PC_KEEP_HANDLE,
|
||||
stat_suffixes);
|
||||
if (fh)
|
||||
{
|
||||
res = fh->fhaccess (flags, true);
|
||||
@ -4152,6 +4154,7 @@ faccessat (int dirfd, const char *pathname, int mode, int flags)
|
||||
else
|
||||
{
|
||||
fhandler_base *fh = build_fh_name (path,
|
||||
PC_KEEP_HANDLE |
|
||||
(flags & AT_SYMLINK_NOFOLLOW)
|
||||
? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW,
|
||||
stat_suffixes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user