Merge pull request #10972 from AdmiralCurtiss/ios-fs-metadata-nop

IOS/FS: Skip writing FST if SetMetadata() changes nothing.
This commit is contained in:
Léo Lam 2022-08-11 16:16:45 +01:00 committed by GitHub
commit be33e1079d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -678,11 +678,15 @@ ResultCode HostFileSystem::SetMetadata(Uid caller_uid, const std::string& path,
if (entry->data.uid != uid && entry->data.is_file && !is_empty)
return ResultCode::FileNotEmpty;
entry->data.gid = gid;
entry->data.uid = uid;
entry->data.attribute = attr;
entry->data.modes = modes;
SaveFst();
if (entry->data.gid != gid || entry->data.uid != uid || entry->data.attribute != attr ||
entry->data.modes != modes)
{
entry->data.gid = gid;
entry->data.uid = uid;
entry->data.attribute = attr;
entry->data.modes = modes;
SaveFst();
}
return ResultCode::Success;
}