diff options
author | El Mostafa Idrassi <el-mostafa.idrassi@prestalab.net> | 2019-10-11 16:02:03 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-11 17:02:03 +0200 |
commit | 621330b726824f05156650eb0603b77dfda05578 (patch) | |
tree | b4ba5eee8cd07694887b88ef30f5aecf6255dfec /src/Platform/PlatformTest.cpp | |
parent | 9463a628a6315ec89934f81dc9e5d838015ec5ce (diff) | |
download | VeraCrypt-621330b726824f05156650eb0603b77dfda05578.tar.gz VeraCrypt-621330b726824f05156650eb0603b77dfda05578.zip |
MacOSX: Fixed devices / partitions not showing in the device selection dialog (#516)
To get the size of each device / partition on the system, the method 'GetDeviceSize()' in 'src/Core/Unix/CoreUnix.cpp' first opens
the device / partition using 'open()' function to get a File Descriptor, then retrieves its size using this File Descriptor.
Starting OS X 10.11 ("El Capitan"), a feature called "System Integrity Protection (SIP)" or less formally, "rootless mode" has been added.
This feature blocks access to certain critical aspects of the OS and Hardware by 3rd-Party programs.
Specifically, low-level access to the system disks, devices and partitions is forbidden ; namely functions like 'open()' for instance fail
with the error code : "EPERM = Operation Not Permitted".
Therefore, for system devices / partitions, 'GetDeviceSize()' fails because of the failure of the 'open()' function, and throws an exception,
which is then caught inside the method 'GetHostDevices()' in '/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp' : this leads to the size of the
device / partition being set to '0'.
Therefore, in the constructor of 'DeviceSelectionDialog' in 'src/Main/Forms/DeviceSelectionDialog.cpp', when the size of a device is '0',
the whole device is skipped, leading to all of its partitions not being treated or shown, even though some of these partitions may have a size which is != 0.
This commit fixes the issue by :
1 - First, checking whether the device size is '0'. If it is the case, the code loops through all the devices partitions : if there is at least one partition
with a size != 0, the device is not skipped. Otherwise, it is.
2 - Then, if the size of the device is '0', the size of the device is not shown to avoid confusing the user.
Also, since the device is not usable, the 'OK' button is not active when the device is selected.
3 - Finally, if a partition's size is '0', it is not shown since it is not usable : we cannot open it.
Signed-off-by: El Mostafa IDRASSI <el-mostafa.idrassi@prestalab.net>
Diffstat (limited to 'src/Platform/PlatformTest.cpp')
0 files changed, 0 insertions, 0 deletions