]> git.saurik.com Git - apple/dyld.git/blobdiff - unit-tests/test-cases/interpose-shared-cache/main.c
dyld-851.27.tar.gz
[apple/dyld.git] / unit-tests / test-cases / interpose-shared-cache / main.c
index 192b3b6dc4f912500549a88240ff121cf79f1a76..93ef8980e8ec34ad752531f6e3dcd66593113a53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <stdlib.h> // exit(), EXIT_SUCCESS
 #include <string.h>
 #include <dlfcn.h>
+#include <stdbool.h>
 
 #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
 
+extern bool allocationSeen(void* p);
+typedef bool (*seenProc)(void*);
 
 int main()
 {
-       const char* x = strdup("123");
-  
-       if ( (strcmp(&x[-16], "hello") == 0) )
+       void* x = strdup("123");
+       
+       seenProc seen = (seenProc)dlsym(RTLD_DEFAULT, "allocationSeen");
+       
+       if ( (seen != NULL) && (*seen)(x) )
                PASS("interpose-basic-shared-cache");
        else
                FAIL("interpose-basic-shared-cache");