Sync usage with man page.
[netbsd-mini2440.git] / regress / usr.bin / rtld / dlerror-cleared / dlerror-cleared.c
blobb61bf31bf775704552287b5dfe9f92fb7ed68fd7
1 #include <stdio.h>
2 #include <dlfcn.h>
3 #include <err.h>
5 int main(void)
7 void *handle;
8 char *error;
11 * Test that an error set by dlopen() persists past a successful
12 * dlopen() call.
14 handle = dlopen("libnonexistent.so", RTLD_LAZY);
15 handle = dlopen("libm.so", RTLD_LAZY);
16 error = dlerror();
17 if (error == NULL)
18 errx(1, "Failed: dlerror() was cleared by successful dlopen()\n");
19 printf("OK: %s\n", error);
21 return 0;