--- MEGAsync-4.9.5.0_Linux/src/MEGASync/mega/src/posix/fs.cpp.orig +++ MEGAsync-4.9.5.0_Linux/src/MEGASync/mega/src/posix/fs.cpp @@ -41,6 +41,10 @@ #include #endif +#ifdef __solaris__ +#include +#endif + #ifdef __linux__ #ifndef __ANDROID__ @@ -1061,6 +1065,7 @@ dirent* d; int removed; struct stat statbuf; + struct stat s; #ifdef USE_IOS const string namestr = adjustBasePath(name); #else @@ -1087,7 +1092,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]))) { @@ -1433,7 +1439,7 @@ } #endif - utsname uts; + struct utsname uts; if (!uname(&uts)) { @@ -1932,10 +1938,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)) { int e = errno; LOG_err << "statfs() failed, errno " << e << " while processing path " << path; @@ -2035,9 +2041,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 (static_cast(statbuf.f_type)) { @@ -2103,9 +2109,9 @@ {"ufsd_NTFS", FS_NTFS} // Paragon NTFS for Mac }; /* 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); @@ -2263,10 +2269,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::max(); - if (statfs(adjustBasePath(drivePath).c_str(), &buffer) < 0) + if (statvfs(adjustBasePath(drivePath).c_str(), &buffer) < 0) { auto result = errno;