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
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc2
-rw-r--r--winsup/cygwin/path.h8
-rw-r--r--winsup/cygwin/security.cc2
-rw-r--r--winsup/cygwin/syscalls.cc7
5 files changed, 24 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 956c9c512..2b87ba788 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,15 @@
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.
* path.cc: Ditto.
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 48ffd6060..3323881dc 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -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;
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 5ebd1f5eb..439bfd264 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -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 ()
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index ffa70f4ab..fafa1f8ee 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -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;
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 4935ebb5e..4226a02fe 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -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);