Changeset - r13188:946b6b8895b9
[Not reviewed]
master
0 2 0
michi_cc - 15 years ago 2009-10-04 21:08:25
michi_cc@openttd.org
(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.
2 files changed with 8 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/os/macosx/macos.h
Show inline comments
 
@@ -75,14 +75,4 @@ static inline bool MacOSVersionIsAtLeast
 
	return true;
 
}
 

	
 
/*
 
 * OSX 10.3.9 has blessed us with a signal with unlikable side effects.
 
 * The most problematic side effect is that it makes OpenTTD 'think' that
 
 * it's running on 10.4.0 or higher and thus tries to link to functions
 
 * that are only defined there. So now we'll remove all and any signal
 
 * handling for OSX < 10.4 and 10.3.9 works as it should at the cost of
 
 * not giving a useful error when savegame loading goes wrong.
 
 */
 
#define signal(sig, func) (MacOSVersionIsAtLeast(10, 4, 0) ? signal(sig, func) : NULL)
 

	
 
#endif /* MACOS_H */
src/os/unix/unix.cpp
Show inline comments
 
@@ -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 *pa
 
{
 
	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 statfs s;
 

	
 
	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;
0 comments (0 inline, 0 general)