]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
support: Add xdlvsym function
authorFlorian Weimer <fweimer@redhat.com>
Fri, 28 Jun 2019 08:15:30 +0000 (10:15 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 28 Jun 2019 08:15:38 +0000 (10:15 +0200)
ChangeLog
support/xdlfcn.c
support/xdlfcn.h

index a3549881519385d3b1fbd76efccecb613fec14f7..07d1bd648b931b45522860f26543efff7b290e15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-28  Florian Weimer  <fweimer@redhat.com>
+
+       * support/xdlfcn.h (xdlvsym): Declare function.
+       * support/xdlfcn.c (xdlvsym): Define funciton.
+
 2019-06-28  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #24744]
index b2e5c2113487ca2171e5b045a69996e339c14c21..11fe4896d18fb8792f3f4c55383fa698e919d55c 100644 (file)
@@ -51,6 +51,26 @@ xdlsym (void *handle, const char *symbol)
   return sym;
 }
 
+void *
+xdlvsym (void *handle, const char *symbol, const char *version)
+{
+  /* Clear any pending errors.  */
+  dlerror ();
+
+  void *sym = dlvsym (handle, symbol, version);
+
+  if (sym == NULL)
+    {
+      const char *error = dlerror ();
+      if (error != NULL)
+        FAIL_EXIT1 ("error: dlvsym: %s\n", error);
+      /* If there was no error, we found a NULL symbol.  Return the
+         NULL value in this case.  */
+    }
+
+  return sym;
+}
+
 void
 xdlclose (void *handle)
 {
index c9cd810a8a7d6a37fc2105203a232dbc8280d424..7f8d4930fc69baa3fc8db298b2cde8fb82b97f2a 100644 (file)
@@ -27,6 +27,7 @@ __BEGIN_DECLS
 void *xdlopen (const char *filename, int flags);
 void *xdlmopen (Lmid_t lmid, const char *filename, int flags);
 void *xdlsym (void *handle, const char *symbol);
+void *xdlvsym (void *handle, const char *symbol, const char *version);
 void xdlclose (void *handle);
 
 __END_DECLS