libaegisub: use statvfs instead of statfs

statvfs is the portable POSIX defined interface and is supported on all
major UNIX platforms.

Originally committed to SVN as r5367.
This commit is contained in:
Grigori Goronzy 2011-02-23 00:54:18 +00:00
parent 7db22972a7
commit 066ec3014a
3 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@
#include <string>
#include <stdio.h>
#include <time.h>
#include <sys/statvfs.h>
#include <algorithm>
#endif // LAGI_PRE

View File

@ -26,7 +26,7 @@
// Unix C
#ifndef _WIN32
# include <sys/mount.h> // yep, this exists on MacOS X as well, but not on Windows.
# include <sys/statvfs.h>
#endif
// Common C++

View File

@ -60,7 +60,7 @@ void time_log(timeval &tv) {
}
uint64_t freespace(std::string &path, PathType type) {
struct statfs fs;
struct statvfs fs;
std::string check(path);
if (type == TypeFile)
@ -68,7 +68,7 @@ uint64_t freespace(std::string &path, PathType type) {
acs::CheckDirRead(check);
if ((statfs(check.c_str(), &fs)) == 0) {
if ((statvfs(check.c_str(), &fs)) == 0) {
return fs.f_bsize * fs.f_bavail;
} else {
/// @todo We need a collective set of exceptions for ENOTDIR, EIO etc.