aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2024-04-12 19:43:02 +0200
committerArisotura <thetotalworm@gmail.com>2024-04-12 19:43:02 +0200
commitd99c571f947ac69890fc60c4525122d1394c7338 (patch)
tree1bb1101414f00b59f19f8d6eead89974dd29c977
parent111dc7a563dc0050939f794445574a342836bdde (diff)
FATStorage: make sure to always properly unmount the volume (fixes evil bug)
-rw-r--r--src/FATStorage.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/FATStorage.cpp b/src/FATStorage.cpp
index 0f1bf23..f735d4b 100644
--- a/src/FATStorage.cpp
+++ b/src/FATStorage.cpp
@@ -110,6 +110,7 @@ bool FATStorage::InjectFile(const std::string& path, u8* data, u32 len)
res = f_mount(&fs, "0:", 1);
if (res != FR_OK)
{
+ f_unmount("0:");
ff_disk_close();
return false;
}
@@ -146,6 +147,7 @@ u32 FATStorage::ReadFile(const std::string& path, u32 start, u32 len, u8* data)
res = f_mount(&fs, "0:", 1);
if (res != FR_OK)
{
+ f_unmount("0:");
ff_disk_close();
return false;
}
@@ -1144,6 +1146,7 @@ bool FATStorage::Save()
res = f_mount(&fs, "0:", 1);
if (res != FR_OK)
{
+ f_unmount("0:");
ff_disk_close();
return false;
}