NetBSD/regress/usr.bin/rtld/dlerror-cleared/dlerror-cleared.c
2003-08-01 07:04:31 +00:00

23 lines
439 B
C

#include <stdio.h>
#include <dlfcn.h>
#include <err.h>
int main(void)
{
void *handle;
char *error;
/*
* Test that an error set by dlopen() persists past a successful
* dlopen() call.
*/
handle = dlopen("libnonexistent.so", RTLD_LAZY);
handle = dlopen("libm.so", RTLD_LAZY);
error = dlerror();
if (error == NULL)
errx(1, "Failed: dlerror() was cleared by successful dlopen()\n");
printf("OK: %s\n", error);
return 0;
}