Obsolete library/mozjs-60
[oi-userland.git] / components / encumbered / megasync / patches / 05-fs.cpp.patch
blob27d1f925eb55fab1295c6085013196ad251931d3
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
3 @@ -39,6 +39,10 @@
4 #include <uuid/uuid.h>
5 #endif
7 +#ifdef __solaris__
8 +#include <sys/statvfs.h>
9 +#endif
11 #ifdef __linux__
13 #ifndef __ANDROID__
14 @@ -1252,6 +1280,7 @@
15 dirent* d;
16 int removed;
17 struct stat statbuf;
18 + struct stat s;
19 #ifdef USE_IOS
20 const string namestr = adjustBasePath(name);
21 #else
22 @@ -1303,7 +1308,8 @@
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
29 || *d->d_name != '.'
30 || (d->d_name[1] && (d->d_name[1] != '.' || d->d_name[2])))
32 @@ -1633,7 +1639,7 @@
34 #endif
36 - utsname uts;
37 + struct utsname uts;
39 if (!uname(&uts))
41 @@ -1880,10 +1880,10 @@
42 #ifdef ENABLE_SYNC
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))
52 return 0;
54 @@ -1927,9 +1934,9 @@
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)
66 @@ -1978,9 +1985,9 @@
67 {"ntfs", FS_NTFS}
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)
89 auto result = errno;