2019-01-08 22:50:21 +01:00
|
|
|
Use statfs() instead of getfsfile() to get device name from a mount point.
|
|
|
|
|
|
|
|
(getfsfile() requires an entry in the fstab file which is often not the case
|
|
|
|
for removable media)
|
|
|
|
|
2020-03-27 12:23:42 +01:00
|
|
|
--- src/dvd_reader.c.orig 2020-03-04 18:57:19 UTC
|
2019-01-08 22:50:21 +01:00
|
|
|
+++ src/dvd_reader.c
|
|
|
|
@@ -64,7 +64,7 @@ static inline int _private_gettimeofday( struct timeva
|
|
|
|
# include <sys/ucred.h>
|
|
|
|
# include <sys/mount.h>
|
|
|
|
#elif defined(SYS_BSD)
|
|
|
|
-# include <fstab.h>
|
|
|
|
+# include <sys/mount.h>
|
|
|
|
#elif defined(__linux__)
|
|
|
|
# include <mntent.h>
|
|
|
|
# include <paths.h>
|
2020-03-27 12:23:42 +01:00
|
|
|
@@ -435,7 +435,7 @@ static dvd_reader_t *DVDOpenCommon( void *priv,
|
|
|
|
return ctx;
|
2019-01-08 22:50:21 +01:00
|
|
|
} else if( S_ISDIR( fileinfo.st_mode ) ) {
|
|
|
|
#if defined(SYS_BSD)
|
|
|
|
- struct fstab* fe;
|
|
|
|
+ struct statfs fs;
|
|
|
|
#elif defined(__sun) || defined(__linux__)
|
|
|
|
FILE *mntfile;
|
|
|
|
#endif
|
2020-03-27 12:23:42 +01:00
|
|
|
@@ -525,13 +525,15 @@ static dvd_reader_t *DVDOpenCommon( void *priv,
|
2019-01-08 22:50:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#elif defined(SYS_BSD)
|
|
|
|
- if( ( fe = getfsfile( path_copy ) ) ) {
|
|
|
|
- dev_name = bsd_block2char( fe->fs_spec );
|
2020-03-27 12:23:42 +01:00
|
|
|
- Log3(ctx, "Attempting to use device %s"
|
|
|
|
- " mounted on %s for CSS authentication",
|
2019-01-08 22:50:21 +01:00
|
|
|
- dev_name,
|
|
|
|
- fe->fs_file );
|
2020-03-27 12:23:42 +01:00
|
|
|
- ctx->rd = DVDOpenImageFile( ctx, dev_name, NULL, have_css );
|
2019-01-08 22:50:21 +01:00
|
|
|
+ if( statfs( path_copy, &fs ) == 0 ) {
|
|
|
|
+ if( !strcmp( path_copy, fs.f_mntonname ) ) {
|
|
|
|
+ dev_name = bsd_block2char( fs.f_mntfromname );
|
2020-03-27 12:23:42 +01:00
|
|
|
+ Log3(ctx, "Attempting to use device %s"
|
|
|
|
+ " mounted on %s for CSS authentication",
|
2019-01-08 22:50:21 +01:00
|
|
|
+ dev_name,
|
|
|
|
+ fs.f_mntonname );
|
2020-03-27 12:23:42 +01:00
|
|
|
+ ctx->rd = DVDOpenImageFile( ctx, dev_name, NULL, have_css );
|
2019-01-08 22:50:21 +01:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
#elif defined(__sun)
|
|
|
|
mntfile = fopen( MNTTAB, "r" );
|