Close all files so /tmp can be deleted on save state load.

Because the file handles were open, the recursive delete was
failing. The previous commit stopped the crash but this should
make the restore actually happen has expected.
This commit is contained in:
Scott Mansell 2016-04-25 18:16:14 +12:00
parent b2f133d2ac
commit 8f4ac5bbad
1 changed files with 10 additions and 7 deletions

View File

@ -270,6 +270,13 @@ void DoState(PointerWrap &p)
p.Do(reply_queue);
p.Do(last_reply_time);
if (p.GetMode() == PointerWrap::MODE_READ)
{
// We need to make sure all file handles are closed so WII_IPC_Devices_fs::DoState can successfully re-create /tmp
for (u32 i = 0; i < IPC_MAX_FDS; i++)
g_FdMap[i].reset();
}
for (const auto& entry : g_DeviceMap)
{
if (entry.second->IsHardware())
@ -280,7 +287,7 @@ void DoState(PointerWrap &p)
if (p.GetMode() == PointerWrap::MODE_READ)
{
for (u32 i=0; i<IPC_MAX_FDS; i++)
for (u32 i=0; i < IPC_MAX_FDS; i++)
{
u32 exists = 0;
p.Do(exists);
@ -300,13 +307,9 @@ void DoState(PointerWrap &p)
g_FdMap[i]->DoState(p);
}
}
else
{
g_FdMap[i].reset();
}
}
for (u32 i=0; i<ES_MAX_COUNT; i++)
for (u32 i=0; i < ES_MAX_COUNT; i++)
{
p.Do(es_inuse[i]);
u32 handleID = es_handles[i]->GetDeviceID();
@ -337,7 +340,7 @@ void DoState(PointerWrap &p)
}
}
for (u32 i=0; i<ES_MAX_COUNT; i++)
for (u32 i=0; i < ES_MAX_COUNT; i++)
{
p.Do(es_inuse[i]);
u32 handleID = es_handles[i]->GetDeviceID();