From: Bruno Haible Date: Sun, 1 Jun 2008 16:18:33 +0000 (+0000) Subject: Patch from glibc. Unlock locks in opposite order of locking. X-Git-Tag: v0.18~401 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aac0c0dfd5cfd230797d9fe8bc2219e99c66d1be;p=thirdparty%2Fgettext.git Patch from glibc. Unlock locks in opposite order of locking. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index fea3deaa4..1bcb4d3ad 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,9 @@ +2008-03-30 Ulrich Drepper + + [BZ #5443] + * dcigettext.c (__dcigettext): Get reader lock for locale data before + looking for translation. + 2008-03-30 Jakub Jelinek * dcigettext.c (_nl_find_msg): Reread nconversions after acquiring diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index 24521f943..fc4cd4bd3 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -530,6 +530,11 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, /* Preserve the `errno' value. */ saved_errno = errno; +#ifdef _LIBC + __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden) + __libc_rwlock_rdlock (__libc_setlocale_lock); +#endif + gl_rwlock_rdlock (_nl_state_lock); /* If DOMAINNAME is NULL, we are interested in the default domain. If @@ -553,7 +558,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, #ifdef HAVE_PER_THREAD_LOCALE # ifndef IN_LIBGLOCALE # ifdef _LIBC - localename = __current_locale_name (category); + localename = _strdupa (_current_locale_name (category)); # else # if HAVE_NL_LOCALE_NAME /* NL_LOCALE_NAME is public glibc API introduced in glibc-2.4. */ @@ -596,6 +601,9 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, retval = (char *) (*foundp)->translation; gl_rwlock_unlock (_nl_state_lock); +# ifdef _LIBC + __libc_rwlock_unlock (__libc_setlocale_lock); +# endif __set_errno (saved_errno); return retval; } @@ -843,6 +851,9 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, retval = plural_lookup (domain, n, retval, retlen); gl_rwlock_unlock (_nl_state_lock); +#ifdef _LIBC + __libc_rwlock_unlock (__libc_setlocale_lock); +#endif return retval; } } @@ -852,6 +863,9 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, /* Return the untranslated MSGID. */ FREE_BLOCKS (block_list); gl_rwlock_unlock (_nl_state_lock); +#ifdef _LIBC + __libc_rwlock_unlock (__libc_setlocale_lock); +#endif #ifndef _LIBC if (!ENABLE_SECURE) {