IOS/FS: Skip writing FST if SetMetadata() changes nothing.

This commit is contained in:
Admiral H. Curtiss 2022-08-10 06:27:37 +02:00
parent 4f96d2f1c3
commit 0d39c4a78a
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
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;
}