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:
authorCorinna Vinschen <corinna@vinschen.de>2012-05-21 16:00:09 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-05-21 16:00:09 +0400
commitece05938f2e2b52dd458e53644f0db6a10bdfd90 (patch)
treed0ffccec5a78da9d9e75fcdbaa801f160d4a9a82 /winsup/cygwin/fhandler_disk_file.cc
parentbb39d14401cb6dc761ce222debcdd80865cf70a1 (diff)
* fhandler_disk_file.cc (path_conv::isgood_inode): Rearrange, take
Samba versions >= 3.5.4 into account, add comments.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 734d0accf..1f47a35a9 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -154,11 +154,26 @@ public:
inline bool
path_conv::isgood_inode (__ino64_t ino) const
{
- /* We can't trust remote inode numbers of only 32 bit. That means,
- remote NT4 NTFS, as well as shares of Samba version < 3.0.
- The known exception are SFU NFS shares, which return the valid 32 bit
- inode number from the remote file system unchanged. */
- return hasgood_inode () && (ino > UINT32_MAX || !isremote () || fs_is_nfs ());
+ /* If the FS doesn't support nonambiguous inode numbers anyway, bail out
+ immediately. */
+ if (!hasgood_inode ())
+ return false;
+ /* If the inode numbers are 64 bit numbers or if it's a local FS, they
+ are to be trusted. */
+ if (ino > UINT32_MAX || !isremote ())
+ return true;
+ /* The inode numbers returned from a remote NT4 NTFS are ephemeral
+ 32 bit numbers. */
+ if (fs_is_ntfs ())
+ return false;
+ /* Starting with version 3.5.4, Samba returns the real inode numbers, if
+ the file is on the same device as the root of the share (Samba function
+ get_FileIndex). 32 bit inode numbers returned by older versions (likely
+ < 3.0) are ephemeral. */
+ if (fs_is_samba () && fs.samba_version () < 0x03050400)
+ return false;
+ /* Otherwise, trust the inode numbers unless proved otherwise. */
+ return true;
}
/* Check reparse point for type. IO_REPARSE_TAG_MOUNT_POINT types are