[vlc-devel] [PATCH 2/2] dvdnav: Limit the security information to macOS 10.15+

david.fuhrmann at gmail.com david.fuhrmann at gmail.com
Fri May 1 12:58:22 CEST 2020


From: David Fuhrmann <dfuhrmann at videolan.org>

This security restriction is only available starting with this
macOS version (Catalina).
---
 modules/access/dvdnav.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 558103eae3..c278a80f15 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -377,21 +377,24 @@ static int AccessDemuxOpen ( vlc_object_t *p_this )
         msg_Warn( p_demux, "cannot open DVD (%s)", psz_file);
 
 #ifdef __APPLE__
-        /* This is only relevant when accessing RAW block devices */
-        if( forced && !strncasecmp( psz_file, "/dev/", 5) )
+        if( __builtin_available( macOS 10.15, * ) )
         {
-            int fd = vlc_open( psz_file, O_RDONLY | O_NONBLOCK );
-            bool permissionError = ( fd == -1 && errno == EPERM );
-            if( fd != -1 )
-                vlc_close( fd );
-
-            if( permissionError )
+            /* This is only relevant when accessing RAW block devices */
+            if( forced && !strncasecmp( psz_file, "/dev/", 5) )
             {
-                msg_Err( p_demux, "Path %s cannot be opened due to unsufficient permissions", psz_file );
-                vlc_dialog_display_error( p_demux, _("Problem accessing a system resource"),
-                                         _("Potentially, macOS blocks access to your disc. "
-                                           "Please open \"System Preferences\" -> \"Security & Privacy\" "
-                                           "and allow VLC to access your external media in \"Files and Folders\" section."));
+                int fd = vlc_open( psz_file, O_RDONLY | O_NONBLOCK );
+                bool permissionError = ( fd == -1 && errno == EPERM );
+                if( fd != -1 )
+                    vlc_close( fd );
+
+                if( permissionError )
+                {
+                    msg_Err( p_demux, "Path %s cannot be opened due to unsufficient permissions", psz_file );
+                    vlc_dialog_display_error( p_demux, _("Problem accessing a system resource"),
+                                             _("Potentially, macOS blocks access to your disc. "
+                                               "Please open \"System Preferences\" -> \"Security & Privacy\" "
+                                               "and allow VLC to access your external media in \"Files and Folders\" section."));
+                }
             }
         }
 #endif
-- 
2.21.1 (Apple Git-122.3)



More information about the vlc-devel mailing list