1 --- MEGAsync_ori/src/MEGASync/mega/src/posix/fs.cpp Thu Mar 10 00:45:05 2022
2 +++ MEGAsync_patched/src/MEGASync/mega/src/posix/fs.cpp Sat Mar 5 15:48:56 2022
8 +#include <sys/statvfs.h>
20 const string namestr = adjustBasePath(name);
24 while ((d = readdir(dp)))
26 - if (d->d_type != DT_DIR
27 + stat(d->d_name, &s);
28 + if ((s.st_mode & S_IFMT) != S_IFDIR
30 || (d->d_name[1] && (d->d_name[1] != '.' || d->d_name[2])))
41 @@ -1880,10 +1880,10 @@
43 fsfp_t PosixFileSystemAccess::fsFingerprint(const LocalPath& path) const
45 - struct statfs statfsbuf;
46 + struct statvfs statfsbuf;
48 // FIXME: statfs() does not really do what we want.
49 - if (statfs(path.localpath.c_str(), &statfsbuf))
50 + if (statvfs(path.localpath.c_str(), &statfsbuf))
55 bool PosixFileSystemAccess::getlocalfstype(const LocalPath& path, FileSystemType& type) const
57 #if defined(__linux__) || defined(__ANDROID__)
58 - struct statfs statbuf;
59 + struct statvfs statbuf;
61 - if (!statfs(path.localpath.c_str(), &statbuf))
62 + if (!statvfs(path.localpath.c_str(), &statbuf))
64 switch (statbuf.f_type)
68 }; /* filesystemTypes */
70 - struct statfs statbuf;
71 + struct statvfs statbuf;
73 - if (!statfs(path.localpath.c_str(), &statbuf))
74 + if (!statvfs(path.localpath.c_str(), &statbuf))
76 auto it = filesystemTypes.find(statbuf.f_fstypename);
78 @@ -2203,10 +2203,10 @@
79 // saturating that quota.
80 m_off_t PosixFileSystemAccess::availableDiskSpace(const LocalPath& drivePath)
82 - struct statfs buffer;
83 + struct statvfs buffer;
84 m_off_t constexpr maximumBytes = std::numeric_limits<m_off_t>::max();
86 - if (statfs(adjustBasePath(drivePath).c_str(), &buffer) < 0)
87 + if (statvfs(adjustBasePath(drivePath).c_str(), &buffer) < 0)