| Index: chrome/installer/util/install_util.cc
|
| diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
|
| index 6eb1b66adab2adf30aa3893a603ad17785444798..e894cbb82ed09763ef6db610db1a0fae2c7de6fd 100644
|
| --- a/chrome/installer/util/install_util.cc
|
| +++ b/chrome/installer/util/install_util.cc
|
| @@ -609,11 +609,14 @@ base::string16 InstallUtil::GetCurrentDate() {
|
|
|
| // Open |path| with minimal access to obtain information about it, returning
|
| // true and populating |file| on success.
|
| -// static
|
| bool InstallUtil::ProgramCompare::OpenForInfo(const base::FilePath& path,
|
| - base::File* file) {
|
| + base::File* file,
|
| + ComparisonType comparison_type) {
|
| DCHECK(file);
|
| - file->Initialize(path, base::File::FLAG_OPEN);
|
| + uint32_t flags = base::File::FLAG_OPEN;
|
| + if (comparison_type == ComparisonType::FILE_OR_DIRECTORY)
|
| + flags |= base::File::FLAG_BACKUP_SEMANTICS;
|
| + file->Initialize(path, flags);
|
| return file->IsValid();
|
| }
|
|
|
| @@ -626,10 +629,15 @@ bool InstallUtil::ProgramCompare::GetInfo(const base::File& file,
|
| }
|
|
|
| InstallUtil::ProgramCompare::ProgramCompare(const base::FilePath& path_to_match)
|
| + : ProgramCompare(path_to_match, ComparisonType::FILE) {}
|
| +
|
| +InstallUtil::ProgramCompare::ProgramCompare(const base::FilePath& path_to_match,
|
| + ComparisonType comparison_type)
|
| : path_to_match_(path_to_match),
|
| - file_info_() {
|
| + file_info_(),
|
| + comparison_type_(comparison_type) {
|
| DCHECK(!path_to_match_.empty());
|
| - if (!OpenForInfo(path_to_match_, &file_)) {
|
| + if (!OpenForInfo(path_to_match_, &file_, comparison_type_)) {
|
| PLOG(WARNING) << "Failed opening " << path_to_match_.value()
|
| << "; falling back to path string comparisons.";
|
| } else if (!GetInfo(file_, &file_info_)) {
|
| @@ -673,8 +681,7 @@ bool InstallUtil::ProgramCompare::EvaluatePath(
|
| base::File file;
|
| BY_HANDLE_FILE_INFORMATION info = {};
|
|
|
| - return (OpenForInfo(path, &file) &&
|
| - GetInfo(file, &info) &&
|
| + return (OpenForInfo(path, &file, comparison_type_) && GetInfo(file, &info) &&
|
| info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
|
| info.nFileIndexHigh == file_info_.nFileIndexHigh &&
|
| info.nFileIndexLow == file_info_.nFileIndexLow);
|
|
|