|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
extern int successful_rtld_next_test (void);
|
|
Packit Service |
82fcde |
extern void *failing_rtld_next_use (void);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static int
|
|
Packit Service |
82fcde |
do_test (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
int result;
|
|
Packit Service |
82fcde |
void *addr;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* First try call a function which uses RTLD_NEXT and calls that
|
|
Packit Service |
82fcde |
function. */
|
|
Packit Service |
82fcde |
result = successful_rtld_next_test ();
|
|
Packit Service |
82fcde |
if (result == 42)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
puts ("RTLD_NEXT seems to work for existing functions");
|
|
Packit Service |
82fcde |
result = 0;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("Heh? `successful_rtld_next_test' returned %d\n", result);
|
|
Packit Service |
82fcde |
result = 1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Next try a function which tries to get a function with RTLD_NEXT
|
|
Packit Service |
82fcde |
but that fails. This dlsym() call should return a NULL pointer
|
|
Packit Service |
82fcde |
and do nothing else. */
|
|
Packit Service |
82fcde |
addr = failing_rtld_next_use ();
|
|
Packit Service |
82fcde |
if (addr == NULL)
|
|
Packit Service |
82fcde |
puts ("dlsym returned NULL for non-existing function. Good");
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
puts ("dlsym found something !?");
|
|
Packit Service |
82fcde |
result = 1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
return result;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <support/test-driver.c>
|