VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-23 16:57:18 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-23 16:57:18 +0200
commit01361e300f21f727cd7133ae24992cf3390cdb9b (patch)
treeca0854563d0a58acfce74076a01237940c79528f /src/Core
parenta23da988d2e8912bf2daad9135eccfe362f1a71d (diff)
downloadVeraCrypt-01361e300f21f727cd7133ae24992cf3390cdb9b.tar.gz
VeraCrypt-01361e300f21f727cd7133ae24992cf3390cdb9b.zip
MacOSX: set FUSE-T workaround max delay to 5 seconds. Make logic specific to FUSE-T volumes.
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/Unix/CoreUnix.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Core/Unix/CoreUnix.cpp b/src/Core/Unix/CoreUnix.cpp
index cd94b2ad..5caa733c 100644
--- a/src/Core/Unix/CoreUnix.cpp
+++ b/src/Core/Unix/CoreUnix.cpp
@@ -304,8 +304,13 @@ namespace VeraCrypt
shared_ptr <VolumeInfo> mountedVol;
// Introduce a retry mechanism with a timeout for control file access
- int controlFileRetries = 5;
- while (controlFileRetries-- > 0)
+ // This workaround is limited to FUSE-T mounted volume under macOS for
+ // which md.Device starts with "fuse-t:"
+#ifdef VC_MACOSX_FUSET
+ bool isFuseT = wstring(mf.Device).find(L"fuse-t:") == 0;
+ int controlFileRetries = 10; // 10 retries with 500ms sleep each, total 5 seconds
+ while (!mountedVol && (controlFileRetries-- > 0))
+#endif
{
try
{
@@ -314,22 +319,23 @@ namespace VeraCrypt
shared_ptr <Stream> controlFileStream (new FileStream (controlFile));
mountedVol = Serializable::DeserializeNew <VolumeInfo> (controlFileStream);
- break; // Control file opened successfully
}
catch (const std::exception& e)
{
+#ifdef VC_MACOSX_FUSET
// if exception starts with "VeraCrypt::Serializer::ValidateName", then
// serialization is not ready yet and we need to wait before retrying
// this happens when FUSE-T is used under macOS and if it is the first time
// the volume is mounted
- if (string (e.what()).find ("VeraCrypt::Serializer::ValidateName") != string::npos)
+ if (isFuseT && string (e.what()).find ("VeraCrypt::Serializer::ValidateName") != string::npos)
{
- Thread::Sleep(250); // Wait before retrying
+ Thread::Sleep(500); // Wait before retrying
}
else
{
- break; // Control file not found
+ break; // Control file not found or other error
}
+#endif
}
}