mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
support: Use dlerror to detect NULL symbols in xdlsym
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2019-02-06 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
* support/xdlfcn.c (xdlopen, xdlclose): Do not call dlerror.
|
||||||
|
(xdlsym): Use dlerror to detect a NULL symbol.
|
||||||
|
|
||||||
2019-02-06 Florian Weimer <fweimer@redhat.com>
|
2019-02-06 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Do not include
|
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Do not include
|
||||||
|
@@ -28,22 +28,25 @@ xdlopen (const char *filename, int flags)
|
|||||||
if (dso == NULL)
|
if (dso == NULL)
|
||||||
FAIL_EXIT1 ("error: dlopen: %s\n", dlerror ());
|
FAIL_EXIT1 ("error: dlopen: %s\n", dlerror ());
|
||||||
|
|
||||||
/* Clear any errors. */
|
|
||||||
dlerror ();
|
|
||||||
|
|
||||||
return dso;
|
return dso;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
xdlsym (void *handle, const char *symbol)
|
xdlsym (void *handle, const char *symbol)
|
||||||
{
|
{
|
||||||
|
/* Clear any pending errors. */
|
||||||
|
dlerror ();
|
||||||
|
|
||||||
void *sym = dlsym (handle, symbol);
|
void *sym = dlsym (handle, symbol);
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
FAIL_EXIT1 ("error: dlsym: %s\n", dlerror ());
|
{
|
||||||
|
const char *error = dlerror ();
|
||||||
/* Clear any errors. */
|
if (error != NULL)
|
||||||
dlerror ();
|
FAIL_EXIT1 ("error: dlsym: %s\n", error);
|
||||||
|
/* If there was no error, we found a NULL symbol. Return the
|
||||||
|
NULL value in this case. */
|
||||||
|
}
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
@@ -53,7 +56,4 @@ xdlclose (void *handle)
|
|||||||
{
|
{
|
||||||
if (dlclose (handle) != 0)
|
if (dlclose (handle) != 0)
|
||||||
FAIL_EXIT1 ("error: dlclose: %s\n", dlerror ());
|
FAIL_EXIT1 ("error: dlclose: %s\n", dlerror ());
|
||||||
|
|
||||||
/* Clear any errors. */
|
|
||||||
dlerror ();
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user