about summary refs log tree commit diff
path: root/libidn
diff options
context:
space:
mode:
Diffstat (limited to 'libidn')
-rw-r--r--libidn/ChangeLog6
-rw-r--r--libidn/idn-stub.c28
-rw-r--r--libidn/shlib-versions1
-rw-r--r--libidn/toutf8.c1
4 files changed, 28 insertions, 8 deletions
diff --git a/libidn/ChangeLog b/libidn/ChangeLog
index e5c052966b..73211970e6 100644
--- a/libidn/ChangeLog
+++ b/libidn/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-07  Ulrich Drepper  <drepper@redhat.com>
+
+	* idn-stub.c: Include <gnu/lib-names.h>.  Use LIBCIDN_SO for dlopen.
+	* shlib-versions: New file.
+	* toutf8.c: Include <sys/param.h>.
+
 2004-03-07  Simon Josefsson  <jas@extundo.com>
 
 	* Banner: New file.
diff --git a/libidn/idn-stub.c b/libidn/idn-stub.c
index f2a11611ef..1e5cc1f6f9 100644
--- a/libidn/idn-stub.c
+++ b/libidn/idn-stub.c
@@ -23,6 +23,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <dlfcn.h>
+#include <gnu/lib-names.h>
+#include <bits/libc-lock.h>
 
 /* Get specification for idna_to_ascii_lz. */
 #include "idna.h"
@@ -53,20 +55,30 @@ __idna_to_ascii_lz (const char *input, char **output, int flags)
 
   if (h == NULL)
     {
-      h = __libc_dlopen ("libcidn.so");
+      __libc_lock_define_initialized (static, lock);
 
+      __libc_lock_lock (lock);
+
+      /* Retest in case some other thread arrived here at the same time.  */
       if (h == NULL)
-	h = (void *) 1l;
-      else
 	{
-	  /* Get the function we are interested in.  */
-	  to_ascii_lz = __libc_dlsym (h, "idna_to_ascii_lz");
-	  if (to_ascii_lz == NULL)
+	  h = __libc_dlopen (LIBCIDN_SO);
+
+	  if (h == NULL)
+	    h = (void *) 1l;
+	  else
 	    {
-	      __libc_dlclose (h);
-	      h = (void *) 1l;
+	      /* Get the function we are interested in.  */
+	      to_ascii_lz = __libc_dlsym (h, "idna_to_ascii_lz");
+	      if (to_ascii_lz == NULL)
+		{
+		  __libc_dlclose (h);
+		  h = (void *) 1l;
+		}
 	    }
 	}
+
+      __libc_lock_unlock (lock);
     }
 
   if (h == (void *) 1l)
diff --git a/libidn/shlib-versions b/libidn/shlib-versions
new file mode 100644
index 0000000000..9b27e5196b
--- /dev/null
+++ b/libidn/shlib-versions
@@ -0,0 +1 @@
+.*-.*-.*	libcidn=1
diff --git a/libidn/toutf8.c b/libidn/toutf8.c
index 450cb6db50..d16efdb5b9 100644
--- a/libidn/toutf8.c
+++ b/libidn/toutf8.c
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <sys/param.h>
 
 #include "stringprep.h"