mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 02:58:02 -06:00
Linux/macOS: check if volume doesn't exist before starting the mount operation.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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]: "))));
|
||||
|
||||
Reference in New Issue
Block a user