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:
authorChristopher Faylor <me@cgf.cx>2006-02-20 00:18:36 +0300
committerChristopher Faylor <me@cgf.cx>2006-02-20 00:18:36 +0300
commit6d618665782201a6b7f05d0e7d9ad1df7346c463 (patch)
tree0ebd5d1fc2934ba22a2e27de4005a2760a45be30
parent84a447aa089362340d143912a7eeb9170400ceee (diff)
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Use NtOpenFile to open
the directory. (fhandler_disk_file::readdir): Use NT_SUCCESS to determine if status represents success.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc24
2 files changed, 25 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 41fd7a8af..16c43aebe 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-19 Christopher Faylor <cgf@timesys.com>
+
+ * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use NtOpenFile
+ to open the directory.
+ (fhandler_disk_file::readdir): Use NT_SUCCESS to determine if status
+ represents success.
+
2006-02-19 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop generating
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 83f92d23d..1d87b6436 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1461,14 +1461,26 @@ fhandler_disk_file::opendir ()
dir->__flags = (pc.normalized_path[0] == '/' && pc.normalized_path[1] == '\0') ? dirent_isroot : 0;
if (!pc.isspecial () && wincap.is_winnt ())
{
- dir->__handle = CreateFile (get_win32_name (), GENERIC_READ,
- wincap.shared (), NULL, OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS, NULL);
- if (dir->__handle == INVALID_HANDLE_VALUE)
+ OBJECT_ATTRIBUTES attr;
+ WCHAR wpath[CYG_MAX_PATH + 10];
+ UNICODE_STRING upath = {0, sizeof (wpath), wpath};
+ IO_STATUS_BLOCK io;
+ NTSTATUS status;
+ SECURITY_ATTRIBUTES sa = sec_none;
+ pc.get_nt_native_path (upath);
+ InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
+ NULL, sa.lpSecurityDescriptor);
+
+ status = NtOpenFile (&dir->__handle,
+ SYNCHRONIZE | FILE_LIST_DIRECTORY,
+ &attr, &io, wincap.shared (),
+ FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE);
+ if (!NT_SUCCESS (status))
{
- __seterrno ();
+ __seterrno_from_nt_status (status);
goto free_dirent;
}
+
/* FileIdBothDirectoryInformation is apparently unsupported on XP
when accessing directories on UDF. When trying to use it so,
NtQueryDirectoryFile returns with STATUS_ACCESS_VIOLATION. It's
@@ -1669,7 +1681,7 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
FALSE, NULL, dir->__d_position == 0);
}
- if (!status)
+ if (NT_SUCCESS (status))
{
buf = (PFILE_ID_BOTH_DIR_INFORMATION) (d_cache (dir) + d_cachepos (dir));
if (buf->NextEntryOffset == 0)