diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 25 |
2 files changed, 25 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a7fdb193f..30d47c43a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2012-05-21 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_disk_file.cc (path_conv::isgood_inode): Rearrange, take + Samba versions >= 3.5.4 into account, add comments. + 2012-05-16 Christopher Faylor <me.cygwin2012@cgf.cx> * DevNotes: Add entry cgf-000009. 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 |