From 8f4ac5bbadb7a080fc94c4925c769309ce7f1b63 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Mon, 25 Apr 2016 18:16:14 +1200 Subject: [PATCH] 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. --- Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp index 7e1c5b6253..63c3d1720e 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp @@ -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; iDoState(p); } } - else - { - g_FdMap[i].reset(); - } } - for (u32 i=0; iGetDeviceID(); @@ -337,7 +340,7 @@ void DoState(PointerWrap &p) } } - for (u32 i=0; iGetDeviceID();