Index: base/file_util_posix.cc |
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
index 8df0d27f2dfbde297b8bc9025f3ce13800d4a531..23218e83a255587b3bb1a2dec702a08c686e207a 100644 |
--- a/base/file_util_posix.cc |
+++ b/base/file_util_posix.cc |
@@ -524,13 +524,25 @@ bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* results) { |
return true; |
} |
-bool GetInode(const FilePath& path, ino_t* inode) { |
+bool AreReferringToSameObject(const FilePath& a, const FilePath& b) { |
+ ino_t inode_a, inode_b; |
+ dev_t dev_a, dev_b; |
+ if (GetInodeAndDevice(a, &inode_a, &dev_a)) { |
+ if (GetInodeAndDevice(b, &inode_b, &dev_b)) { |
+ return (inode_a == inode_b) && (dev_a == dev_b); |
+ } |
+ } |
+ return false; |
+} |
+ |
+bool GetInodeAndDevice(const FilePath& path, ino_t* inode, dev_t* dev) { |
Mark Mentovai
2011/03/11 20:13:52
Nobody was using this function?
Mark Mentovai
2011/03/11 20:13:52
GetDeviceAndInode would make more sense to me.
|
base::ThreadRestrictions::AssertIOAllowed(); // For call to stat(). |
struct stat buffer; |
int result = stat(path.value().c_str(), &buffer); |
if (result < 0) |
return false; |
+ *dev = buffer.st_dev; |
*inode = buffer.st_ino; |
return true; |
} |