Skip to content
Snippets Groups Projects
Commit 132ef662 authored by Marvin Scholz's avatar Marvin Scholz Committed by Jean-Baptiste Kempf
Browse files

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.
parent d3e16b42
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,19 @@ typedef struct
#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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment