--- MEGAsync_ori/src/MEGASync/mega/src/posix/fs.cpp	Thu Mar 10 00:45:05 2022
+++ MEGAsync_patched/src/MEGASync/mega/src/posix/fs.cpp	Sat Mar  5 15:48:56 2022
@@ -39,6 +39,10 @@
 #include <uuid/uuid.h>
 #endif
 
+#ifdef __solaris__
+#include <sys/statvfs.h>
+#endif
+
 #ifdef __linux__
 
 #ifndef __ANDROID__
@@ -1252,6 +1280,7 @@
     dirent* d;
     int removed;
     struct stat statbuf;
+	struct stat s;
 #ifdef USE_IOS
     const string namestr = adjustBasePath(name);
 #else
@@ -1303,7 +1308,8 @@
 
             while ((d = readdir(dp)))
             {
-                if (d->d_type != DT_DIR
+				stat(d->d_name, &s);
+                if ((s.st_mode & S_IFMT) != S_IFDIR
                  || *d->d_name != '.'
                  || (d->d_name[1] && (d->d_name[1] != '.' || d->d_name[2])))
                 {
@@ -1633,7 +1639,7 @@
     }
 #endif
 
-    utsname uts;
+    struct utsname uts;
 
     if (!uname(&uts))
     {
@@ -1880,10 +1880,10 @@
 #ifdef ENABLE_SYNC
 fsfp_t PosixFileSystemAccess::fsFingerprint(const LocalPath& path) const
 {
-    struct statfs statfsbuf;
+    struct statvfs statfsbuf;
 
     // FIXME: statfs() does not really do what we want.
-    if (statfs(path.localpath.c_str(), &statfsbuf))
+    if (statvfs(path.localpath.c_str(), &statfsbuf))
     {
         return 0;
     }
@@ -1927,9 +1934,9 @@
 bool PosixFileSystemAccess::getlocalfstype(const LocalPath& path, FileSystemType& type) const
 {
 #if defined(__linux__) || defined(__ANDROID__)
-    struct statfs statbuf;
+    struct statvfs statbuf;
 
-    if (!statfs(path.localpath.c_str(), &statbuf))
+    if (!statvfs(path.localpath.c_str(), &statbuf))
     {
         switch (statbuf.f_type)
         {
@@ -1978,9 +1985,9 @@
         {"ntfs",  FS_NTFS}
     }; /* filesystemTypes */
 
-    struct statfs statbuf;
+    struct statvfs statbuf;
 
-    if (!statfs(path.localpath.c_str(), &statbuf))
+    if (!statvfs(path.localpath.c_str(), &statbuf))
     {
         auto it = filesystemTypes.find(statbuf.f_fstypename);
 
@@ -2203,10 +2203,10 @@
 // saturating that quota.
 m_off_t PosixFileSystemAccess::availableDiskSpace(const LocalPath& drivePath)
 {
-    struct statfs buffer;
+    struct statvfs buffer;
     m_off_t constexpr maximumBytes = std::numeric_limits<m_off_t>::max();
 
-    if (statfs(adjustBasePath(drivePath).c_str(), &buffer) < 0)
+    if (statvfs(adjustBasePath(drivePath).c_str(), &buffer) < 0)
     {
         auto result = errno;