Alexandre Julliard : mountmgr: Move the macOS device access check to the Unix library.
Alexandre Julliard
julliard at winehq.org
Mon Nov 29 16:26:53 CST 2021
Module: wine
Branch: master
Commit: fd5acd68b07d749d9e98633d2b1b46e734454135
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fd5acd68b07d749d9e98633d2b1b46e734454135
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Nov 29 17:10:44 2021 +0100
mountmgr: Move the macOS device access check to the Unix library.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mountmgr.sys/device.c | 8 +-------
dlls/mountmgr.sys/unixlib.c | 10 ++++++++++
dlls/mountmgr.sys/unixlib.h | 1 +
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index a657cf19d29..724c618be20 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -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 )))
{
diff --git a/dlls/mountmgr.sys/unixlib.c b/dlls/mountmgr.sys/unixlib.c
index e45b6696ae6..52a3fce66d6 100644
--- a/dlls/mountmgr.sys/unixlib.c
+++ b/dlls/mountmgr.sys/unixlib.c
@@ -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,
diff --git a/dlls/mountmgr.sys/unixlib.h b/dlls/mountmgr.sys/unixlib.h
index 08f7e313236..e7846a764da 100644
--- a/dlls/mountmgr.sys/unixlib.h
+++ b/dlls/mountmgr.sys/unixlib.h
@@ -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,
More information about the wine-cvs
mailing list