mountmgr: Move the macOS device access check to the Unix library.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-11-29 17:10:44 +01:00
parent e54f6d8f8f
commit fd5acd68b0
3 changed files with 12 additions and 7 deletions

View File

@ -915,13 +915,7 @@ static BOOL get_volume_device_info( struct volume *volume )
if (!unix_device)
return FALSE;
#ifdef __APPLE__
if (access( unix_device, R_OK ))
{
WARN("Unable to open %s, not accessible\n", debugstr_a(unix_device));
return FALSE;
}
#endif
if (MOUNTMGR_CALL( check_device_access, volume->device->unix_device )) return FALSE;
if (!(name = wine_get_dos_file_name( unix_device )))
{

View File

@ -319,6 +319,15 @@ static NTSTATUS match_unixdev( void *args )
return !stat( params->device, &st ) && st.st_rdev == params->unix_dev;
}
static NTSTATUS check_device_access( void *args )
{
#ifdef __APPLE__
const char *unix_device = args;
if (access( unix_device, R_OK )) return STATUS_ACCESS_DENIED;
#endif
return STATUS_SUCCESS;
}
static NTSTATUS detect_serial_ports( void *args )
{
const struct detect_ports_params *params = args;
@ -434,6 +443,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
get_volume_dos_devices,
read_volume_file,
match_unixdev,
check_device_access,
detect_serial_ports,
detect_parallel_ports,
set_shell_folder,

View File

@ -145,6 +145,7 @@ enum mountmgr_funcs
unix_get_volume_dos_devices,
unix_read_volume_file,
unix_match_unixdev,
unix_check_device_access,
unix_detect_serial_ports,
unix_detect_parallel_ports,
unix_set_shell_folder,