mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 21:23:52 +08:00
9114625bad
This patch fixes a "set but not used" warning from dlfcn/failtestmod.c. A variable is used only to store the return value from dlsym. As I understand this test, the point is simply to do a sequence of load / unload operations in a loop, and all that matters here is that dlsym gets called and returns without crashing, not what its return value is. So this patch removes the assignment to a variable. Tested for x86_64. * dlfcn/failtestmod.c (constr): Do not store result of dlsym in a variable.
26 lines
444 B
C
26 lines
444 B
C
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
extern void constr (void) __attribute__ ((__constructor__));
|
|
void
|
|
__attribute__ ((__constructor__))
|
|
constr (void)
|
|
{
|
|
void *handle;
|
|
|
|
/* Open the library. */
|
|
handle = dlopen (NULL, RTLD_NOW);
|
|
if (handle == NULL)
|
|
{
|
|
puts ("Cannot get handle to own object");
|
|
return;
|
|
}
|
|
|
|
/* Get a symbol. */
|
|
dlsym (handle, "main");
|
|
puts ("called dlsym() to get main");
|
|
|
|
dlclose (handle);
|
|
}
|