Sync with upstream master
This commit is contained in:
parent
f6520166f4
commit
4d96e3246c
@ -1,128 +0,0 @@
|
||||
From bf18f175afdb59cdcd1016995b351e2bbb1d6ba7 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@redhat.com>
|
||||
Date: Tue, 21 Jun 2011 17:28:57 +0200
|
||||
Subject: [PATCH] Don't use gethostbyaddr to determine canonical name
|
||||
|
||||
* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use gethostbyaddr
|
||||
to determine canonical name.
|
||||
|
||||
---
|
||||
ChangeLog | 5 +++
|
||||
sysdeps/posix/getaddrinfo.c | 77 +++----------------------------------------
|
||||
2 files changed, 10 insertions(+), 72 deletions(-)
|
||||
|
||||
--- a/sysdeps/posix/getaddrinfo.c
|
||||
+++ b/sysdeps/posix/getaddrinfo.c
|
||||
@@ -565,8 +565,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||
|
||||
/* If we do not have to look for IPv6 addresses, use
|
||||
the simple, old functions, which do not support
|
||||
- IPv6 scope ids. */
|
||||
- if (req->ai_family == AF_INET)
|
||||
+ IPv6 scope ids, nor retrieving the canonical name. */
|
||||
+ if (req->ai_family == AF_INET && (req->ai_flags & AI_CANONNAME) == 0)
|
||||
{
|
||||
/* Allocate additional room for struct host_data. */
|
||||
size_t tmpbuflen = (512 + MAX_NR_ALIASES * sizeof(char*)
|
||||
@@ -1107,70 +1107,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||
/* Only the first entry gets the canonical name. */
|
||||
if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
|
||||
{
|
||||
- char *tmpbuf2 = NULL;
|
||||
- bool malloc_tmpbuf2 = false;
|
||||
-
|
||||
if (canon == NULL)
|
||||
- {
|
||||
- struct hostent *h = NULL;
|
||||
- int herrno;
|
||||
- struct hostent th;
|
||||
- /* Add room for struct host_data. */
|
||||
- size_t tmpbuf2len = (512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1)
|
||||
- * sizeof(char*) + 16 * sizeof(char));
|
||||
-
|
||||
- do
|
||||
- {
|
||||
- if (__libc_use_alloca (alloca_used + 2 * tmpbuf2len))
|
||||
- tmpbuf2 = extend_alloca_account (tmpbuf2, tmpbuf2len,
|
||||
- tmpbuf2len * 2,
|
||||
- alloca_used);
|
||||
- else
|
||||
- {
|
||||
- char *newp = realloc (malloc_tmpbuf2 ? tmpbuf2 : NULL,
|
||||
- 2 * tmpbuf2len);
|
||||
- if (newp == NULL)
|
||||
- {
|
||||
- if (malloc_tmpbuf2)
|
||||
- free (tmpbuf2);
|
||||
- result = -EAI_MEMORY;
|
||||
- goto free_and_return;
|
||||
- }
|
||||
-
|
||||
- tmpbuf2 = newp;
|
||||
- tmpbuf2len = 2 * tmpbuf2len;
|
||||
- malloc_tmpbuf2 = true;
|
||||
- }
|
||||
-
|
||||
- rc = __gethostbyaddr_r (at2->addr,
|
||||
- ((at2->family == AF_INET6)
|
||||
- ? sizeof (struct in6_addr)
|
||||
- : sizeof (struct in_addr)),
|
||||
- at2->family, &th, tmpbuf2,
|
||||
- tmpbuf2len, &h, &herrno);
|
||||
- }
|
||||
- while (rc == ERANGE && herrno == NETDB_INTERNAL);
|
||||
-
|
||||
- if (rc != 0 && herrno == NETDB_INTERNAL)
|
||||
- {
|
||||
- if (malloc_tmpbuf2)
|
||||
- free (tmpbuf2);
|
||||
-
|
||||
- __set_h_errno (herrno);
|
||||
- result = -EAI_SYSTEM;
|
||||
- goto free_and_return;
|
||||
- }
|
||||
-
|
||||
- if (h != NULL)
|
||||
- canon = h->h_name;
|
||||
- else
|
||||
- {
|
||||
- assert (orig_name != NULL);
|
||||
- /* If the canonical name cannot be determined, use
|
||||
- the passed in string. */
|
||||
- canon = orig_name;
|
||||
- }
|
||||
- }
|
||||
+ /* If the canonical name cannot be determined, use
|
||||
+ the passed in string. */
|
||||
+ canon = orig_name;
|
||||
|
||||
#ifdef HAVE_LIBIDN
|
||||
if (req->ai_flags & AI_CANONIDN)
|
||||
@@ -1185,9 +1125,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||
int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
|
||||
if (rc != IDNA_SUCCESS)
|
||||
{
|
||||
- if (malloc_tmpbuf2)
|
||||
- free (tmpbuf2);
|
||||
-
|
||||
if (rc == IDNA_MALLOC_ERROR)
|
||||
result = -EAI_MEMORY;
|
||||
else if (rc == IDNA_DLOPEN_ERROR)
|
||||
@@ -1217,17 +1154,11 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||
canon = strdup (canon);
|
||||
if (canon == NULL)
|
||||
{
|
||||
- if (malloc_tmpbuf2)
|
||||
- free (tmpbuf2);
|
||||
-
|
||||
result = -EAI_MEMORY;
|
||||
goto free_and_return;
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- if (malloc_tmpbuf2)
|
||||
- free (tmpbuf2);
|
||||
}
|
||||
|
||||
family = at2->family;
|
@ -1,140 +0,0 @@
|
||||
#
|
||||
# Posted upstream:
|
||||
# https://sourceware.org/ml/libc-alpha/2013-10/msg00103.html
|
||||
#
|
||||
diff --git a/locale/locarchive.h b/locale/locarchive.h
|
||||
index f2d8477..fec3b1a 100644
|
||||
--- a/locale/locarchive.h
|
||||
+++ b/locale/locarchive.h
|
||||
@@ -80,6 +80,8 @@ struct locrecent
|
||||
|
||||
struct locarhandle
|
||||
{
|
||||
+ /* Full path to the locale archive file. */
|
||||
+ const char *fname;
|
||||
int fd;
|
||||
void *addr;
|
||||
size_t mmaped;
|
||||
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
|
||||
index 8b9866a..d664232 100644
|
||||
--- a/locale/programs/localedef.c
|
||||
+++ b/locale/programs/localedef.c
|
||||
@@ -209,7 +209,7 @@ main (int argc, char *argv[])
|
||||
|
||||
/* Handle a few special cases. */
|
||||
if (list_archive)
|
||||
- show_archive_content (verbose);
|
||||
+ show_archive_content (remaining > 1 ? argv[remaining] : NULL, verbose);
|
||||
if (add_to_archive)
|
||||
return add_locales_to_archive (argc - remaining, &argv[remaining],
|
||||
replace_archive);
|
||||
diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h
|
||||
index e010c72..0cfc416 100644
|
||||
--- a/locale/programs/localedef.h
|
||||
+++ b/locale/programs/localedef.h
|
||||
@@ -170,7 +170,8 @@ extern int add_locales_to_archive (size_t nlist, char *list[], bool replace);
|
||||
/* Removed named locales from archive. */
|
||||
extern int delete_locales_from_archive (size_t nlist, char *list[]);
|
||||
|
||||
-/* List content of locale archive. */
|
||||
-extern void show_archive_content (int verbose) __attribute__ ((noreturn));
|
||||
+/* List content of locale archive. If FNAME is non-null use that as
|
||||
+ the locale archive to list, otherwise the default. */
|
||||
+extern void show_archive_content (char *fname, int verbose) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* localedef.h */
|
||||
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
|
||||
index 13dba0f..b88f1b1 100644
|
||||
--- a/locale/programs/locarchive.c
|
||||
+++ b/locale/programs/locarchive.c
|
||||
@@ -223,6 +223,7 @@ create_archive (const char *archivefname, struct locarhandle *ah)
|
||||
_("cannot change mode of new locale archive"));
|
||||
}
|
||||
|
||||
+ ah->fname = NULL;
|
||||
ah->fd = fd;
|
||||
ah->mmap_base = mmap_base;
|
||||
ah->mmap_len = mmap_len;
|
||||
@@ -562,11 +563,19 @@ open_archive (struct locarhandle *ah, bool readonly)
|
||||
struct locarhead head;
|
||||
int retry = 0;
|
||||
size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
|
||||
- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)];
|
||||
+ char fname[prefix_len + sizeof (ARCHIVE_NAME)];
|
||||
+ char *archivefname = ah->fname;
|
||||
+ bool defaultfname = false;
|
||||
|
||||
- if (output_prefix)
|
||||
- memcpy (archivefname, output_prefix, prefix_len);
|
||||
- strcpy (archivefname + prefix_len, ARCHIVE_NAME);
|
||||
+ /* If ah has a non-NULL fname open that otherwise open the default. */
|
||||
+ if (archivefname == NULL)
|
||||
+ {
|
||||
+ defaultfname = true;
|
||||
+ archivefname = fname;
|
||||
+ if (output_prefix)
|
||||
+ memcpy (archivefname, output_prefix, prefix_len);
|
||||
+ strcpy (archivefname + prefix_len, ARCHIVE_NAME);
|
||||
+ }
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -574,8 +583,11 @@ open_archive (struct locarhandle *ah, bool readonly)
|
||||
fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR);
|
||||
if (fd == -1)
|
||||
{
|
||||
- /* Maybe the file does not yet exist. */
|
||||
- if (errno == ENOENT)
|
||||
+ /* Maybe the file does not yet exist? If we are opening
|
||||
+ the default locale archive we ignore the failure and
|
||||
+ list an empty archive, otherwise we print an error
|
||||
+ and exit. */
|
||||
+ if (errno == ENOENT && defaultfname)
|
||||
{
|
||||
if (readonly)
|
||||
{
|
||||
@@ -1324,6 +1336,7 @@ add_locales_to_archive (nlist, list, replace)
|
||||
|
||||
/* Open the archive. This call never returns if we cannot
|
||||
successfully open the archive. */
|
||||
+ ah.fname = NULL;
|
||||
open_archive (&ah, false);
|
||||
|
||||
while (nlist-- > 0)
|
||||
@@ -1523,6 +1536,7 @@ delete_locales_from_archive (nlist, list)
|
||||
|
||||
/* Open the archive. This call never returns if we cannot
|
||||
successfully open the archive. */
|
||||
+ ah.fname = NULL;
|
||||
open_archive (&ah, false);
|
||||
|
||||
head = ah.addr;
|
||||
@@ -1612,7 +1626,7 @@ dataentcmp (const void *a, const void *b)
|
||||
|
||||
|
||||
void
|
||||
-show_archive_content (int verbose)
|
||||
+show_archive_content (char *fname, int verbose)
|
||||
{
|
||||
struct locarhandle ah;
|
||||
struct locarhead *head;
|
||||
@@ -1622,6 +1636,7 @@ show_archive_content (int verbose)
|
||||
|
||||
/* Open the archive. This call never returns if we cannot
|
||||
successfully open the archive. */
|
||||
+ ah.fname = fname;
|
||||
open_archive (&ah, true);
|
||||
|
||||
head = ah.addr;
|
||||
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
|
||||
index 4969391..6410cbd 100644
|
||||
--- a/locale/programs/locfile.c
|
||||
+++ b/locale/programs/locfile.c
|
||||
@@ -343,6 +343,7 @@ write_all_categories (struct localedef_t *definitions,
|
||||
|
||||
/* Open the archive. This call never returns if we cannot
|
||||
successfully open the archive. */
|
||||
+ ah.fname = NULL;
|
||||
open_archive (&ah, false);
|
||||
|
||||
if (add_locale_to_archive (&ah, locname, to_archive, true) != 0)
|
14
glibc.spec
14
glibc.spec
@ -1,6 +1,6 @@
|
||||
%define glibcsrcdir glibc-2.18-303-g1e14558
|
||||
%define glibcsrcdir glibc-2.18-322-gd1f23d4
|
||||
%define glibcversion 2.18.90
|
||||
%define glibcrelease 11%{?dist}
|
||||
%define glibcrelease 12%{?dist}
|
||||
# Pre-release tarballs are pulled in from git using a command that is
|
||||
# effectively:
|
||||
#
|
||||
@ -151,7 +151,6 @@ Patch0012: %{name}-fedora-linux-tcsetattr.patch
|
||||
Patch0014: %{name}-fedora-nptl-linklibc.patch
|
||||
Patch0015: %{name}-fedora-localedef.patch
|
||||
Patch0016: %{name}-fedora-i386-tls-direct-seg-refs.patch
|
||||
Patch0017: %{name}-fedora-gai-canonical.patch
|
||||
Patch0019: %{name}-fedora-nis-rh188246.patch
|
||||
Patch0020: %{name}-fedora-manual-dircategory.patch
|
||||
Patch0024: %{name}-fedora-locarchive.patch
|
||||
@ -184,9 +183,6 @@ Patch0043: %{name}-rh1009623.patch
|
||||
# binutils bug.
|
||||
Patch0044: %{name}-rh1009145.patch
|
||||
|
||||
# Provide localedef with --list-archive FILE support.
|
||||
Patch0045: %{name}-localedef-arg.patch
|
||||
|
||||
# Allow applications to call pthread_atfork without libpthread.so.
|
||||
Patch0046: %{name}-rh1013801.patch
|
||||
|
||||
@ -520,7 +516,6 @@ package or when debugging this package.
|
||||
%patch0014 -p1
|
||||
%patch0015 -p1
|
||||
%patch0016 -p1
|
||||
%patch0017 -p1
|
||||
%patch0019 -p1
|
||||
%patch0020 -p1
|
||||
%patch2021 -p1
|
||||
@ -543,7 +538,6 @@ package or when debugging this package.
|
||||
%patch0042 -p1
|
||||
%patch0043 -p1
|
||||
%patch0044 -p1
|
||||
%patch0045 -p1
|
||||
%patch0046 -p1
|
||||
|
||||
##############################################################################
|
||||
@ -1630,6 +1624,10 @@ rm -f *.filelist*
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Oct 21 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.18.90-12
|
||||
- Allow fill_archive to be called with NULL fname.
|
||||
- Sync with upstream master.
|
||||
|
||||
* Tue Oct 15 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.18.90-11
|
||||
- Sync with upstream master.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user