#include <stdio.h>
#include <dlfcn.h>
#include "test_support.h"
static void tryImage(const char* path)
{
void* handle = dlopen(path, RTLD_LAZY);
if ( handle == NULL ) {
FAIL("dlerror(\"%s\"): %s", path, dlerror());
}
int result = dlclose(handle);
if ( result != 0 ) {
FAIL("dlclose(\"%s\"): %s", path, dlerror());
}
}
int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
tryImage("./IOKit.framework/IOKit");
tryImage("./././IOKit/../IOKit.framework/IOKit");
tryImage("./IOKit");
tryImage("/usr/lib/libSystem.dylib");
tryImage("//usr/lib/libSystem.dylib");
tryImage("/usr/./lib/libSystem.dylib");
PASS("Success");
}