nodelete1.c 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include <dlfcn.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. int fini_ran;
  5. #define LIBNAME1 "nodelmod1.so"
  6. static int
  7. do_test (void)
  8. {
  9. /* Verify ability to reload RTLD_NODELETE libraries.
  10. */
  11. void *p;
  12. p = dlopen (LIBNAME1, RTLD_NOW);
  13. if (p == NULL)
  14. {
  15. printf ("failed to load "LIBNAME1": %s\n", dlerror ());
  16. exit (1);
  17. }
  18. if (dlclose (p) != 0)
  19. {
  20. puts ("failed to close "LIBNAME1"");
  21. exit (1);
  22. }
  23. p = dlopen (LIBNAME1, RTLD_LAZY);
  24. if (p == NULL)
  25. {
  26. printf ("failed to load "LIBNAME1": %s\n", dlerror ());
  27. exit (1);
  28. }
  29. if (dlclose (p) != 0)
  30. {
  31. puts ("failed to close "LIBNAME1"");
  32. exit (1);
  33. }
  34. p = dlopen ("nodelmod2.so", RTLD_LAZY);
  35. if (p == NULL)
  36. {
  37. printf ("failed to load \"nodelmod2.so\": %s\n", dlerror ());
  38. exit (1);
  39. }
  40. if (dlclose (p) != 0)
  41. {
  42. puts ("failed to close \"nodelmod2.so\"");
  43. exit (1);
  44. }
  45. return 0;
  46. }
  47. #define TEST_FUNCTION do_test ()
  48. #include "../test-skeleton.c"