Linux/macOS: check if volume doesn't exist before starting the mount operation.

This commit is contained in:
Mounir IDRASSI committed 2024-12-23 23:10:37 +01:00
1 parent f05ce4eaf3
commit b6e698b376
2 files changed
+25

No files matched your search

+13
View File
@@ -826,6 +826,19 @@ namespace VeraCrypt
return volume;
}
// check if the volume path exists using stat function. Only ENOENT error is handled to exclude permission denied error
struct stat statBuf;
if (stat (string (*options.Path).c_str(), &statBuf) != 0)
{
if (errno == ENOENT)
{
SystemException ex (SRC_POS);
ShowError (ex);
return volume;
}
}
try
{
if ((!options.Password || options.Password->IsEmpty())
+12
View File
@@ -1335,6 +1335,18 @@ namespace VeraCrypt
return volume;
}
// check if the volume path exists using stat function. Only ENOENT error is handled to exclude permission denied error
struct stat statBuf;
if (stat (string (*options.Path).c_str(), &statBuf) != 0)
{
if (errno == ENOENT)
{
SystemException ex (SRC_POS);
ShowError (ex);
return volume;
}
}
// Mount point
if (!options.MountPoint && !options.NoFilesystem)
options.MountPoint.reset (new DirectoryPath (AskString (_("Enter mount directory [default]: "))));