|
|
d8307d |
commit 17432d7150bdab3bce2ea66c70ad6c920f54077a
|
|
|
d8307d |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
d8307d |
Date: Fri Jun 28 10:15:30 2019 +0200
|
|
|
d8307d |
|
|
|
d8307d |
support: Add xdlvsym function
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/support/xdlfcn.c b/support/xdlfcn.c
|
|
|
d8307d |
index f34bb059c00f27f7..b4a6b85649d181c8 100644
|
|
|
d8307d |
--- a/support/xdlfcn.c
|
|
|
d8307d |
+++ b/support/xdlfcn.c
|
|
|
d8307d |
@@ -48,6 +48,26 @@ xdlsym (void *handle, const char *symbol)
|
|
|
d8307d |
return sym;
|
|
|
d8307d |
}
|
|
|
d8307d |
|
|
|
d8307d |
+void *
|
|
|
d8307d |
+xdlvsym (void *handle, const char *symbol, const char *version)
|
|
|
d8307d |
+{
|
|
|
d8307d |
+ /* Clear any pending errors. */
|
|
|
d8307d |
+ dlerror ();
|
|
|
d8307d |
+
|
|
|
d8307d |
+ void *sym = dlvsym (handle, symbol, version);
|
|
|
d8307d |
+
|
|
|
d8307d |
+ if (sym == NULL)
|
|
|
d8307d |
+ {
|
|
|
d8307d |
+ const char *error = dlerror ();
|
|
|
d8307d |
+ if (error != NULL)
|
|
|
d8307d |
+ FAIL_EXIT1 ("error: dlvsym: %s\n", error);
|
|
|
d8307d |
+ /* If there was no error, we found a NULL symbol. Return the
|
|
|
d8307d |
+ NULL value in this case. */
|
|
|
d8307d |
+ }
|
|
|
d8307d |
+
|
|
|
d8307d |
+ return sym;
|
|
|
d8307d |
+}
|
|
|
d8307d |
+
|
|
|
d8307d |
void
|
|
|
d8307d |
xdlclose (void *handle)
|
|
|
d8307d |
{
|
|
|
d8307d |
diff --git a/support/xdlfcn.h b/support/xdlfcn.h
|
|
|
d8307d |
index 5ab7494e70924f52..ab1cbb3cb9bb1cc7 100644
|
|
|
d8307d |
--- a/support/xdlfcn.h
|
|
|
d8307d |
+++ b/support/xdlfcn.h
|
|
|
d8307d |
@@ -26,6 +26,7 @@ __BEGIN_DECLS
|
|
|
d8307d |
/* Each of these terminates process on failure with relevant error message. */
|
|
|
d8307d |
void *xdlopen (const char *filename, int flags);
|
|
|
d8307d |
void *xdlsym (void *handle, const char *symbol);
|
|
|
d8307d |
+void *xdlvsym (void *handle, const char *symbol, const char *version);
|
|
|
d8307d |
void xdlclose (void *handle);
|
|
|
d8307d |
|
|
|
d8307d |
|