diff options
author | michi_cc <michi_cc@openttd.org> | 2009-10-04 21:08:25 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2009-10-04 21:08:25 +0000 |
commit | 4f98178fcd110ebfc10fe42e609d27faf7105b73 (patch) | |
tree | aabdd87f27b58ed934c679c2872d5b2b9bc8a1ea /src/os/unix | |
parent | e2ef24919e8f9dbefa06161d5b6fe5cbc6eb7bd5 (diff) | |
download | openttd-4f98178fcd110ebfc10fe42e609d27faf7105b73.tar.xz |
(svn r17705) -Fix: [OSX] Re-enable signal handling on OSX 10.3.9. Trying to link with an undefined symbols that lives in the system library seems to confuse the loader on 10.3.9. Use a different function to circumvent it.
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/unix.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp index 7d51b7549..7250751f5 100644 --- a/src/os/unix/unix.cpp +++ b/src/os/unix/unix.cpp @@ -21,7 +21,9 @@ #include <time.h> #include <signal.h> -#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__) +#ifdef __APPLE__ + #include <sys/mount.h> +#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__) #define HAS_STATVFS #endif @@ -71,17 +73,16 @@ bool FiosGetDiskFreeSpace(const char *path, uint64 *tot) { uint64 free = 0; -#ifdef HAS_STATVFS -# ifdef __APPLE__ - /* OSX 10.3 lacks statvfs so don't try to use it even though later versions of OSX has it. */ - if (MacOSVersionIsAtLeast(10, 4, 0)) -# endif - { - struct statvfs s; +#ifdef __APPLE__ + struct statfs s; - if (statvfs(path, &s) != 0) return false; - free = (uint64)s.f_frsize * s.f_bavail; - } + if (statfs(path, &s) != 0) return false; + free = (uint64)s.f_bsize * s.f_bavail; +#elif defined(HAS_STATVFS) + struct statvfs s; + + if (statvfs(path, &s) != 0) return false; + free = (uint64)s.f_frsize * s.f_bavail; #endif if (tot != NULL) *tot = free; return true; |