diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-09-26 04:45:24 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-09-26 04:45:24 +0000 |
commit | ce7265c7438e18f2e4ea81582131a783a1cdd601 (patch) | |
tree | de765fda756af9cf90b3d7d3c528ac0c11f93de9 /intl/finddomain.c | |
parent | f6b90f42997f98bdd91dac713d610b66edc55c7c (diff) | |
download | glibc-ce7265c7438e18f2e4ea81582131a783a1cdd601.tar glibc-ce7265c7438e18f2e4ea81582131a783a1cdd601.tar.gz glibc-ce7265c7438e18f2e4ea81582131a783a1cdd601.tar.bz2 glibc-ce7265c7438e18f2e4ea81582131a783a1cdd601.zip |
[BZ #322]
Update.
* intl/dcigettext.c (DCIGETTEXT): Protect tfind/tsearch calls.
* intl/dcigettext.c (_nl_find_msg): Call _nl_load_domain also if
decided < 0.
* intl/finddomain.c (_nl_find_domain): Likewise.
* intl/l10nflist.c (_nl_make_l10nflist): Initialize lock.
* intl/loadinfo.h (struct loaded_l10nfile): Add lock element.
* intl/loadmsgcat.c (_nl_load_domain): Set decided to 1 only once we
are done. First set to -1 to signal initialization is ongoing.
Protect against concurrent callers with recursive lock.
duplicate address recognition does not copy junk. [BZ #322]
Diffstat (limited to 'intl/finddomain.c')
-rw-r--r-- | intl/finddomain.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/intl/finddomain.c b/intl/finddomain.c index 9af765d540..39e54755d2 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -80,22 +80,22 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) */ /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ - __libc_lock_define_initialized (static, lock); - __libc_lock_lock (lock); + __libc_rwlock_define_initialized (static, lock); + __libc_rwlock_rdlock (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); + __libc_rwlock_unlock (lock); if (retval != NULL) { /* We know something about this locale. */ int cnt; - if (retval->decided == 0) + if (retval->decided <= 0) _nl_load_domain (retval, domainbinding); if (retval->data != NULL) @@ -103,7 +103,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) { - if (retval->successor[cnt]->decided == 0) + if (retval->successor[cnt]->decided <= 0) _nl_load_domain (retval->successor[cnt], domainbinding); if (retval->successor[cnt]->data != NULL) @@ -141,7 +141,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) &codeset, &normalized_codeset); /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ - __libc_lock_lock (lock); + __libc_rwlock_wrlock (lock); /* Create all possible locale entries which might be interested in generalization. */ @@ -149,20 +149,20 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) strlen (dirname) + 1, mask, language, territory, codeset, normalized_codeset, modifier, domainname, 1); - __libc_lock_unlock (lock); + __libc_rwlock_unlock (lock); if (retval == NULL) /* This means we are out of core. */ return NULL; - if (retval->decided == 0) + if (retval->decided <= 0) _nl_load_domain (retval, domainbinding); if (retval->data == NULL) { int cnt; for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) { - if (retval->successor[cnt]->decided == 0) + if (retval->successor[cnt]->decided <= 0) _nl_load_domain (retval->successor[cnt], domainbinding); if (retval->successor[cnt]->data != NULL) break; |