mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
core: file_sys: fix for racing in fs mount
This commit is contained in:
parent
07de1ee977
commit
7b8f0d2a19
|
@ -15,6 +15,7 @@ void MntPoints::Mount(const std::filesystem::path& host_folder, const std::strin
|
|||
}
|
||||
|
||||
void MntPoints::Unmount(const std::filesystem::path& host_folder, const std::string& guest_folder) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
auto it = std::remove_if(m_mnt_pairs.begin(), m_mnt_pairs.end(),
|
||||
[&](const MntPair& pair) { return pair.mount == guest_folder; });
|
||||
m_mnt_pairs.erase(it, m_mnt_pairs.end());
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
std::filesystem::path GetHostPath(std::string_view guest_directory);
|
||||
|
||||
const MntPair* GetMount(const std::string& guest_path) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
const auto it = std::ranges::find_if(
|
||||
m_mnt_pairs, [&](const auto& mount) { return guest_path.starts_with(mount.mount); });
|
||||
return it == m_mnt_pairs.end() ? nullptr : &*it;
|
||||
|
|
Loading…
Reference in a new issue