about summary refs log tree commit diff
path: root/intl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-26 03:40:38 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-26 03:40:38 +0000
commitf6b90f42997f98bdd91dac713d610b66edc55c7c (patch)
tree8caf79c4e2a4a9a933a8f6158d4247550a9eb2e9 /intl
parent4faf24a33da46dd52e52b43c2b641b611253cbff (diff)
downloadglibc-f6b90f42997f98bdd91dac713d610b66edc55c7c.tar.gz
glibc-f6b90f42997f98bdd91dac713d610b66edc55c7c.tar.xz
glibc-f6b90f42997f98bdd91dac713d610b66edc55c7c.zip
Update.
	* intl/finddomain.c (_nl_find_domain): Protect calls to
	_nl_make_l10nflist.
Diffstat (limited to 'intl')
-rw-r--r--intl/finddomain.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/intl/finddomain.c b/intl/finddomain.c
index 6988d9efc0..9af765d540 100644
--- a/intl/finddomain.c
+++ b/intl/finddomain.c
@@ -35,6 +35,7 @@
 #include "gettextP.h"
 #ifdef _LIBC
 # include <libintl.h>
+# include <bits/libc-lock.h>
 #else
 # include "libgnuintl.h"
 #endif
@@ -78,11 +79,17 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
 		(4) modifier
    */
 
+  /* We need to protect modifying the _NL_LOADED_DOMAINS data.  */
+  __libc_lock_define_initialized (static, lock);
+  __libc_lock_lock (lock);
+
   /* If we have already tested for this locale entry there has to
      be one data set in the list of loaded domains.  */
   retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
 			       strlen (dirname) + 1, 0, locale, NULL, NULL,
 			       NULL, NULL, domainname, 0);
+  __libc_lock_unlock (lock);
+
   if (retval != NULL)
     {
       /* We know something about this locale.  */
@@ -102,6 +109,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
 	  if (retval->successor[cnt]->data != NULL)
 	    break;
 	}
+
       return cnt >= 0 ? retval : NULL;
       /* NOTREACHED */
     }
@@ -132,12 +140,17 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
   mask = _nl_explode_name (locale, &language, &modifier, &territory,
 			   &codeset, &normalized_codeset);
 
+  /* We need to protect modifying the _NL_LOADED_DOMAINS data.  */
+  __libc_lock_lock (lock);
+
   /* Create all possible locale entries which might be interested in
      generalization.  */
   retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
 			       strlen (dirname) + 1, mask, language, territory,
 			       codeset, normalized_codeset, modifier,
 			       domainname, 1);
+  __libc_lock_unlock (lock);
+
   if (retval == NULL)
     /* This means we are out of core.  */
     return NULL;