From b8ec72d947a1494db06552d31b3a637ccab79b31 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 8 Mar 2004 07:58:18 +0000 Subject: Update. 2004-03-07 Ulrich Drepper * idn-stub.c: Include . Use LIBCIDN_SO for dlopen. * shlib-versions: New file. * toutf8.c: Include . --- libidn/idn-stub.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'libidn/idn-stub.c') 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 #include #include +#include +#include /* 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) -- cgit v1.2.3