[vlc-commits] [Git][videolan/vlc][3.0.x] access: file: properly report local files on Darwin
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Thu Jul 28 07:36:55 UTC 2022
Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC
Commits:
d4dd3372 by Marvin Scholz at 2022-07-27T00:14:13+02:00
access: file: properly report local files on Darwin
While Darwin implements fstatvfs, the statvfs structures f_flag
field is only defined to contain two flags, ST_RDONLY and ST_NOSUID.
So the check for MNT_LOCAL would always be false, reporting all files
as non-local.
To mitigate that, on Darwin we can just use fstatfs and check
statfs.f_flags for MNT_LOCAL.
(cherry picked from commit 132ef662489942d81cf1d974690cf6f10589ce7f)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>
- - - - -
1 changed file:
- modules/access/file.c
Changes:
=====================================
modules/access/file.c
=====================================
@@ -74,7 +74,19 @@ struct access_sys_t
#if !defined (_WIN32) && !defined (__OS2__)
static bool IsRemote (int fd)
{
-#if defined (HAVE_FSTATVFS) && defined (MNT_LOCAL)
+#if defined(__APPLE__)
+ /* This has to preceed the general fstatvfs implmentation below,
+ * as even though Darwin has fstatvfs, it does not expose the
+ * MNT_LOCAL in the statvfs.f_flag field.
+ */
+ struct statfs sfs;
+
+ if (fstatfs (fd, &sfs))
+ return false;
+
+ return !((sfs.f_flags & MNT_LOCAL) == MNT_LOCAL);
+
+#elif defined (HAVE_FSTATVFS) && defined (MNT_LOCAL)
struct statvfs stf;
if (fstatvfs (fd, &stf))
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d4dd33720a8fbf83feaf2e70970246f62910e313
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d4dd33720a8fbf83feaf2e70970246f62910e313
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list