Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mach_override.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnson <github@lapcatsoftware.com>2011-10-10 20:23:46 +0400
committerJeff Johnson <github@lapcatsoftware.com>2011-10-10 20:23:46 +0400
commit820b779918f927cd144729f8fd8e520e6b73bfbf (patch)
treed1e0805ad8cc0dc072a4a175dd2086fbcaa681df
parentfbd051708ac97ad41bb4c083454a83c0f7870d61 (diff)
Fix test so that it works on Mac OS X 10.7 Lion.
-rw-r--r--mach_override/test_mach_override.cp10
1 files changed, 8 insertions, 2 deletions
diff --git a/mach_override/test_mach_override.cp b/mach_override/test_mach_override.cp
index eb5d000..77ad748 100644
--- a/mach_override/test_mach_override.cp
+++ b/mach_override/test_mach_override.cp
@@ -2,6 +2,7 @@
#include <assert.h>
#include <string.h>
#include <errno.h>
+#include <CoreServices/CoreServices.h>
#include "mach_override.h"
#define assertStrEqual( EXPECTED, ACTUAL ) if( strcmp( (EXPECTED), (ACTUAL) ) != 0 ) { printf( "EXPECTED: %s\nACTUAL: %s\n", (EXPECTED), (ACTUAL)); assert( strcmp( (EXPECTED), (ACTUAL) ) == 0 ); }
@@ -40,17 +41,22 @@ void testLocalFunctionOverrideByPointer() {
#pragma mark Test System Override by Pointer
char* (*strerrorPtr)(int) = strerror;
+const char* strerrReturnValue = "Unknown error: 0";
void testSystemFunctionOverrideByPointer() {
+ SInt32 sysv;
+ if (Gestalt( gestaltSystemVersion, &sysv ) == noErr && sysv >= 0x1070)
+ strerrReturnValue = "Undefined error: 0";
+
// Test original.
- assertStrEqual( "Unknown error: 0", strerrorPtr( 0 ) );
+ assertStrEqual( strerrReturnValue, strerrorPtr( 0 ) );
// Override system function by pointer.
kern_return_t err;
MACH_OVERRIDE( char*, strerror, (int errnum), err ) {
// Test calling through the reentry island back into the original
// implementation.
- assertStrEqual( "Unknown error: 0", strerror_reenter( 0 ) );
+ assertStrEqual( strerrReturnValue, strerror_reenter( 0 ) );
return (char *)"strerrorOverride";
} END_MACH_OVERRIDE(strerror);