system: ensure inode value is correct

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-10-16 05:12:16 +03:00
parent f57198e6af
commit 53652399b3
+10 -7
View File
@@ -178,10 +178,13 @@ class System(object):
@staticmethod
def inode(path):
if System.is_unix():
return os.lstat(path).st_ino
# getdirinfo from ntfsutils works on both files and dirs
info = System.getdirinfo(path)
return hash((info.dwVolumeSerialNumber,
info.nFileIndexHigh,
info.nFileIndexLow))
inode = os.lstat(path).st_ino
else:
# getdirinfo from ntfsutils works on both files and dirs
info = System.getdirinfo(path)
inode = abs(hash((info.dwVolumeSerialNumber,
info.nFileIndexHigh,
info.nFileIndexLow)))
assert inode >= 0
assert inode < 2**64
return inode