[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r3595 - in /fsf/trunk/libc: ChangeLog intl/dcigettext.c intl/gettextP.h intl/loadmsgcat.c sysdeps/posix/getaddrinfo.c
- To: commits@xxxxxxxxxx
- Subject: [commits] r3595 - in /fsf/trunk/libc: ChangeLog intl/dcigettext.c intl/gettextP.h intl/loadmsgcat.c sysdeps/posix/getaddrinfo.c
- From: eglibc@xxxxxxxxxx
- Date: Tue, 25 Sep 2007 07:03:38 -0000
Author: eglibc
Date: Tue Sep 25 00:03:37 2007
New Revision: 3595
Log:
Import glibc-mainline for 2007-09-25
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/intl/dcigettext.c
fsf/trunk/libc/intl/gettextP.h
fsf/trunk/libc/intl/loadmsgcat.c
fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Sep 25 00:03:37 2007
@@ -1,7 +1,21 @@
+2007-09-24 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ [BZ #5058]
+ * intl/gettextP.h (struct loaded_domain): Add conversions_lock member.
+ * intl/loadmsgcat.c (_nl_load_domain): Initialize conversions_lock.
+ (_nl_unload_domain): Finalize conversions_lock.
+ * intl/dcigettext.c (_nl_find_msg): Take conversions_lock before
+ handling table of known conversions.
+
+2007-09-24 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * sysdeps/posix/getaddrinfo.c (getaddrinfo): Use
+ close_not_cancel_no_status instead of close.
+
2007-09-13 Aurelien Jarno <aurelien@xxxxxxxxxxx>
[BZ #5028]
- * posix/regcomp.c (lookup_collation_sequence_value): check that
+ * posix/regcomp.c (lookup_collation_sequence_value): Check that
nrules != 0 for multibyte chars.
2007-09-23 Ulrich Drepper <drepper@xxxxxxxxxx>
Modified: fsf/trunk/libc/intl/dcigettext.c
==============================================================================
--- fsf/trunk/libc/intl/dcigettext.c (original)
+++ fsf/trunk/libc/intl/dcigettext.c Tue Sep 25 00:03:37 2007
@@ -850,6 +850,9 @@
/* We are supposed to do a conversion. */
const char *encoding = get_output_charset (domainbinding);
+ /* Protect against reallocation of the table. */
+ __libc_rwlock_rdlock (domain->conversions_lock);
+
/* Search whether a table with converted translations for this
encoding has already been allocated. */
size_t nconversions = domain->nconversions;
@@ -866,8 +869,25 @@
}
}
+ __libc_rwlock_unlock (domain->conversions_lock);
+
if (convd == NULL)
{
+ /* We have to allocate a new conversions table. */
+ __libc_rwlock_wrlock (domain->conversions_lock);
+
+ /* Maybe in the meantime somebody added the translation.
+ Recheck. */
+ for (i = nconversions; i > 0; )
+ {
+ i--;
+ if (strcmp (domain->conversions[i].encoding, encoding) == 0)
+ {
+ convd = &domain->conversions[i];
+ goto found_convd;
+ }
+ }
+
/* Allocate a table for the converted translations for this
encoding. */
struct converted_domain *new_conversions =
@@ -876,9 +896,13 @@
(nconversions + 1) * sizeof (struct converted_domain));
if (__builtin_expect (new_conversions == NULL, 0))
- /* Nothing we can do, no more memory. We cannot use the
- translation because it might be encoded incorrectly. */
- return (char *) -1;
+ {
+ /* Nothing we can do, no more memory. We cannot use the
+ translation because it might be encoded incorrectly. */
+ unlock_fail:
+ __libc_rwlock_unlock (domain->conversions_lock);
+ return (char *) -1;
+ }
domain->conversions = new_conversions;
@@ -887,7 +911,7 @@
if (__builtin_expect (encoding == NULL, 0))
/* Nothing we can do, no more memory. We cannot use the
translation because it might be encoded incorrectly. */
- return (char *) -1;
+ goto unlock_fail;
convd = &new_conversions[nconversions];
convd->encoding = encoding;
@@ -989,6 +1013,9 @@
convd->conv_tab = NULL;
/* Here domain->conversions is still == new_conversions. */
domain->nconversions++;
+
+ found_convd:
+ __libc_rwlock_unlock (domain->conversions_lock);
}
if (
Modified: fsf/trunk/libc/intl/gettextP.h
==============================================================================
--- fsf/trunk/libc/intl/gettextP.h (original)
+++ fsf/trunk/libc/intl/gettextP.h Tue Sep 25 00:03:37 2007
@@ -147,6 +147,7 @@
/* Cache of charset conversions of the translated strings. */
struct converted_domain *conversions;
size_t nconversions;
+ __libc_rwlock_define (, conversions_lock);
const struct expression *plural;
unsigned long int nplurals;
Modified: fsf/trunk/libc/intl/loadmsgcat.c
==============================================================================
--- fsf/trunk/libc/intl/loadmsgcat.c (original)
+++ fsf/trunk/libc/intl/loadmsgcat.c Tue Sep 25 00:03:37 2007
@@ -1,5 +1,5 @@
/* Load needed message catalogs.
- Copyright (C) 1995-2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -1252,6 +1252,7 @@
/* No caches of converted translations so far. */
domain->conversions = NULL;
domain->nconversions = 0;
+ __libc_rwlock_init (domain->conversions_lock);
/* Get the header entry and look for a plural specification. */
nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
@@ -1290,6 +1291,7 @@
}
if (domain->conversions != NULL)
free (domain->conversions);
+ __libc_rwlock_fini (domain->conversions_lock);
if (domain->malloced)
free (domain->malloced);
Modified: fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/trunk/libc/sysdeps/posix/getaddrinfo.c Tue Sep 25 00:03:37 2007
@@ -1975,7 +1975,7 @@
{
if (fd != -1)
close_retry:
- close (fd);
+ close_not_cancel_no_status (fd);
af = q->ai_family;
fd = __socket (af, SOCK_DGRAM, IPPROTO_IP);
}