This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.29.9000-34-g3b93559


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  3b935595859e0232b74594c5aca6da88a31f90b3 (commit)
      from  b4333340654113ce912cb0deb8856a87487cc428 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3b935595859e0232b74594c5aca6da88a31f90b3

commit 3b935595859e0232b74594c5aca6da88a31f90b3
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Feb 6 16:26:39 2019 +0100

    support: Use dlerror to detect NULL symbols in xdlsym

diff --git a/ChangeLog b/ChangeLog
index f244457..66fa654 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 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>
+
 	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Do not include
 	<stap-probe.h>.
 	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
diff --git a/support/xdlfcn.c b/support/xdlfcn.c
index 2f2ac76..b2e5c21 100644
--- a/support/xdlfcn.c
+++ b/support/xdlfcn.c
@@ -28,22 +28,25 @@ xdlopen (const char *filename, int flags)
   if (dso == NULL)
     FAIL_EXIT1 ("error: dlopen: %s\n", dlerror ());
 
-  /* Clear any errors.  */
-  dlerror ();
-
   return dso;
 }
 
 void *
 xdlsym (void *handle, const char *symbol)
 {
+  /* Clear any pending errors.  */
+  dlerror ();
+
   void *sym = dlsym (handle, symbol);
 
   if (sym == NULL)
-    FAIL_EXIT1 ("error: dlsym: %s\n", dlerror ());
-
-  /* Clear any errors.  */
-  dlerror ();
+    {
+      const char *error = dlerror ();
+      if (error != NULL)
+        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;
 }
@@ -53,7 +56,4 @@ xdlclose (void *handle)
 {
   if (dlclose (handle) != 0)
     FAIL_EXIT1 ("error: dlclose: %s\n", dlerror ());
-
-  /* Clear any errors.  */
-  dlerror ();
 }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    5 +++++
 support/xdlfcn.c |   20 ++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]