| Index: base/file_util_posix.cc
|
| diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
|
| index 8df0d27f2dfbde297b8bc9025f3ce13800d4a531..a9c69135d3be39dcc75a82142de1bf4547f1cf22 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) {
|
| 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;
|
| }
|
|
|