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:
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 3d286ebe9..2445eb279 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -96,6 +96,10 @@ path_conv::ndisk_links (DWORD nNumberOfLinks)
return count + saw_dot;
}
+#define FS_IS_SAMBA (FILE_CASE_SENSITIVE_SEARCH \
+ | FILE_CASE_PRESERVED_NAMES \
+ | FILE_PERSISTENT_ACLS)
+
bool
path_conv::hasgood_inode ()
{
@@ -117,10 +121,7 @@ path_conv::hasgood_inode ()
An exception is Samba, which seems to return valid inode numbers
without having the FILE_SUPPORTS_OBJECT_IDS flag set. So we're
testing for the flag values returned by a 3.x Samba explicitely
- for now. */
-#define FS_IS_SAMBA (FILE_CASE_SENSITIVE_SEARCH \
- | FILE_CASE_PRESERVED_NAMES \
- | FILE_PERSISTENT_ACLS)
+ for now. But note the comment in the below "is_samba" function. */
if (!(fs_flags () & FILE_SUPPORTS_OBJECT_IDS)
&& fs_flags () != FS_IS_SAMBA)
return false;
@@ -128,6 +129,25 @@ path_conv::hasgood_inode ()
return true;
}
+bool
+path_conv::is_samba ()
+{
+ /* Something weird happens on Samba. FileIdBothDirectoryInformation
+ seems to work nicely, but only up to the 128th entry in the
+ directory. After reaching this entry, the next call to
+ NtQueryDirectoryFile(FileIdBothDirectoryInformation) returns
+ STATUS_INVAILD_LEVEL. Why should we care, we can just switch to
+ FileBothDirectoryInformation, isn't it? Nope! The next call to
+ NtQueryDirectoryFile(FileBothDirectoryInformation) actually returns
+ STATUS_NO_MORE_FILES, regardless how many files are left unread in
+ the directory. This does not happen when using
+ FileBothDirectoryInformation right from the start. In that case we
+ can read the whole directory unmolested. So we have to excempt
+ Samba from the usage of FileIdBothDirectoryInformation entirely,
+ even though Samba returns valid File IDs. */
+ return drive_type () == DRIVE_REMOTE && fs_flags () == FS_IS_SAMBA;
+}
+
int __stdcall
fhandler_base::fstat_by_handle (struct __stat64 *buf)
{
@@ -1461,7 +1481,7 @@ fhandler_disk_file::opendir ()
if (pc.hasgood_inode ())
{
dir->__flags |= dirent_set_d_ino;
- if (wincap.has_fileid_dirinfo ())
+ if (wincap.has_fileid_dirinfo () && !pc.is_samba ())
dir->__flags |= dirent_get_d_ino;
}
}