refactor(savedata): clear the mount result once the mount point is made

#5173 changes the create condition right after the last error check, and #3950 removes the comment after the create block, so clearing the result in either place made the pull requests conflict. The result is still cleared only after every error return and before anything is written to it.
This commit is contained in:
Yunus Shaikh 2026-10-13 07:09:13 -07:00
parent 4ccf888291
commit 6a46563a93
1 changed files with 1 additions and 1 deletions

View File

@ -497,7 +497,6 @@ static int mount3(const SaveDataMount3* mount, SaveDataMountResult* mount_result
if (slot == -1) {
return SAVE_DATA_ERROR_MOUNT_FULL;
}
std::memset(mount_result, 0, sizeof(*mount_result));
if (create || create2) {
std::filesystem::create_directories(real_path);
}
@ -505,6 +504,7 @@ static int mount3(const SaveDataMount3* mount, SaveDataMountResult* mount_result
// path resolver maps it to the save directory, whose name may be far longer.
const std::string mountPoint = "/savedata" + std::to_string(slot);
AddPathAlias_nid_no_patch(mountPoint.c_str(), std::filesystem::absolute(real_path).string().c_str());
std::memset(mount_result, 0, sizeof(*mount_result));
g_slots[slot].used = true;
g_slots[slot].mount_point = mountPoint;
g_slots[slot].real_path = real_path;