Back to index

glibc  2.9
next.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 
00003 
00004 extern int successful_rtld_next_test (void);
00005 extern void *failing_rtld_next_use (void);
00006 
00007 
00008 static int
00009 do_test (void)
00010 {
00011   int result;
00012   void *addr;
00013 
00014   /* First try call a function which uses RTLD_NEXT and calls that
00015      function.  */
00016   result = successful_rtld_next_test ();
00017   if (result == 42)
00018     {
00019       puts ("RTLD_NEXT seems to work for existing functions");
00020       result = 0;
00021     }
00022   else
00023     {
00024       printf ("Heh?  `successful_rtld_next_test' returned %d\n", result);
00025       result = 1;
00026     }
00027 
00028   /* Next try a function which tries to get a function with RTLD_NEXT
00029      but that fails.  This dlsym() call should return a NULL pointer
00030      and do nothing else.  */
00031   addr = failing_rtld_next_use ();
00032   if (addr == NULL)
00033     puts ("dlsym returned NULL for non-existing function.  Good");
00034   else
00035     {
00036       puts ("dlsym found something !?");
00037       result = 1;
00038     }
00039 
00040   return result;
00041 }
00042 
00043 #define TEST_FUNCTION do_test ()
00044 #include "../test-skeleton.c"