getfsent() only returns '/' entry on my system (10.8)

I only have 10.7 around to test, but this bug was reported ages ago:
https://trac.videolan.org/vlc/ticket/4069

I don't have a BSD, so I can't test it on BSD too but I don't see why
this code couldn't be shared on all BSD.

--- dvdread.orig/src/dvd_reader.c	2012-03-15 09:29:40.000000000 -0400
+++ dvdread/src/dvd_reader.c	2012-03-15 09:32:29.000000000 -0400
@@ -58,6 +58,10 @@
 
 #if defined(__sun)
 #include <sys/mnttab.h>
+#elif defined(__APPLE__)
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
 #elif defined(SYS_BSD)
 #include <fstab.h>
 #elif defined(__linux__)
@@ -474,7 +478,28 @@
       path_copy[1] = '\0';
     }
 
-#if defined(SYS_BSD)
+#if defined(__APPLE__)
+    struct statfs s[128];
+    int r = getfsstat(NULL, 0, MNT_NOWAIT);
+    if (r > 0) {
+        if (r > 128)
+            r = 128;
+        r = getfsstat(s, r * sizeof(s[0]), MNT_NOWAIT);
+        int i;
+        for (i=0; i<r; i++) {
+            if (!strcmp(path_copy, s[i].f_mntonname)) {
+                dev_name = bsd_block2char(s[i].f_mntfromname);
+                fprintf( stderr,
+                        "libdvdread: Attempting to use device %s"
+                        " mounted on %s for CSS authentication\n",
+                        dev_name,
+                        s[i].f_mntonname);
+                auth_drive = DVDOpenImageFile( dev_name, have_css );
+                break;
+            }
+        }
+    }
+#elif defined(SYS_BSD)
     if( ( fe = getfsfile( path_copy ) ) ) {
       dev_name = bsd_block2char( fe->fs_spec );
       fprintf( stderr,

_______________________________________________
DVDnav-discuss mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss

Reply via email to