summaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-05-20 23:14:07 +0200
committerThomas Schwinge <thomas@codesourcery.com>2013-05-20 23:14:07 +0200
commitc59fc9e953db9723b34eebe96c3ad2cef893c4bb (patch)
treebd9c6dd8e8343d17c80a1a5d6762e1f99f3367b7 /resolv
parent654611b4d68129954697bb94d49c671e164ec938 (diff)
parent784b06732b24f3079e88e5be4284b645aa715512 (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts: configure configure.in hurd/ctty-input.c hurd/ctty-output.c hurd/hurd/signal.h hurd/hurdexec.c hurd/hurdmsg.c hurd/hurdsig.c hurd/hurdsocket.h socket/recvmmsg.c socket/sendmmsg.c sysdeps/mach/hurd/i386/sigreturn.c sysdeps/mach/hurd/i386/trampoline.c sysdeps/mach/hurd/pipe.c sysdeps/mach/hurd/recvmsg.c sysdeps/mach/hurd/sendmsg.c sysdeps/mach/hurd/sigaction.c sysdeps/mach/hurd/sigpending.c sysdeps/mach/hurd/sigprocmask.c sysdeps/mach/hurd/sigsuspend.c sysdeps/mach/hurd/sigwait.c sysdeps/mach/hurd/socketpair.c sysdeps/mach/hurd/tls.h sysdeps/unix/sysv/linux/recvmmsg.c sysdeps/unix/sysv/linux/sendmmsg.c
Diffstat (limited to 'resolv')
-rw-r--r--resolv/Makefile3
-rw-r--r--resolv/gai_cancel.c2
-rw-r--r--resolv/gai_error.c2
-rw-r--r--resolv/gai_misc.c2
-rw-r--r--resolv/gai_misc.h2
-rw-r--r--resolv/gai_notify.c2
-rw-r--r--resolv/gai_sigqueue.c3
-rw-r--r--resolv/gai_suspend.c2
-rw-r--r--resolv/getaddrinfo_a.c2
-rw-r--r--resolv/netdb.h4
-rw-r--r--resolv/nss_dns/dns-canon.c2
-rw-r--r--resolv/nss_dns/dns-host.c27
-rw-r--r--resolv/nss_dns/dns-network.c3
-rw-r--r--resolv/res-state.c2
-rw-r--r--resolv/res_hconf.c3
-rw-r--r--resolv/res_hconf.h2
-rw-r--r--resolv/res_query.c30
-rw-r--r--resolv/tst-leaks.c2
-rw-r--r--resolv/tst-leaks2.c2
19 files changed, 55 insertions, 42 deletions
diff --git a/resolv/Makefile b/resolv/Makefile
index a398694772..d3635bc115 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1994-2001,2003,2004,2007,2008,2011,2012
-# Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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
diff --git a/resolv/gai_cancel.c b/resolv/gai_cancel.c
index 9082381015..e625a913fc 100644
--- a/resolv/gai_cancel.c
+++ b/resolv/gai_cancel.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/gai_error.c b/resolv/gai_error.c
index 9803b67536..80c5429076 100644
--- a/resolv/gai_error.c
+++ b/resolv/gai_error.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c
index 35f1133e69..6b73aac096 100644
--- a/resolv/gai_misc.c
+++ b/resolv/gai_misc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2012 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/gai_misc.h b/resolv/gai_misc.h
index 1def6a3298..a7ba463e24 100644
--- a/resolv/gai_misc.h
+++ b/resolv/gai_misc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/gai_notify.c b/resolv/gai_notify.c
index 0af0206b02..9e4bdf6671 100644
--- a/resolv/gai_notify.c
+++ b/resolv/gai_notify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/gai_sigqueue.c b/resolv/gai_sigqueue.c
index 22aff54ec4..ec2a1e7e8d 100644
--- a/resolv/gai_sigqueue.c
+++ b/resolv/gai_sigqueue.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 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
@@ -32,4 +32,3 @@ __gai_sigqueue (sig, val, caller_pid)
}
stub_warning (__gai_sigqueue)
-#include <stub-tag.h>
diff --git a/resolv/gai_suspend.c b/resolv/gai_suspend.c
index dc73569807..a61a337857 100644
--- a/resolv/gai_suspend.c
+++ b/resolv/gai_suspend.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/getaddrinfo_a.c b/resolv/getaddrinfo_a.c
index f1070d61e4..4ea803df36 100644
--- a/resolv/getaddrinfo_a.c
+++ b/resolv/getaddrinfo_a.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 19bcc87fd8..412343b42b 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -1,4 +1,4 @@
- /* Copyright (C) 1996-2004, 2009-2011, 2012 Free Software Foundation, Inc.
+ /* Copyright (C) 1996-2013 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
@@ -76,7 +76,7 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
# define NO_ADDRESS NO_DATA /* No address, look for MX record. */
#endif
-#ifdef __USE_XOPEN2K
+#if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED
/* Highest reserved Internet port number. */
# define IPPORT_RESERVED 1024
#endif
diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c
index bb5650aa64..090ed7dda2 100644
--- a/resolv/nss_dns/dns-canon.c
+++ b/resolv/nss_dns/dns-canon.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 6b62c05883..af5c166da9 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -199,6 +199,11 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
status = NSS_STATUS_TRYAGAIN;
h_errno = TRY_AGAIN;
break;
+ /* System has run out of file descriptors. */
+ case EMFILE:
+ case ENFILE:
+ h_errno = NETDB_INTERNAL;
+ /* Fall through. */
case ECONNREFUSED:
case ETIMEDOUT:
status = NSS_STATUS_UNAVAIL;
@@ -311,14 +316,26 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
&ans2p, &nans2p, &resplen2);
if (n < 0)
{
- if (errno == ESRCH)
+ switch (errno)
{
+ case ESRCH:
status = NSS_STATUS_TRYAGAIN;
h_errno = TRY_AGAIN;
+ break;
+ /* System has run out of file descriptors. */
+ case EMFILE:
+ case ENFILE:
+ h_errno = NETDB_INTERNAL;
+ /* Fall through. */
+ case ECONNREFUSED:
+ case ETIMEDOUT:
+ status = NSS_STATUS_UNAVAIL;
+ break;
+ default:
+ status = NSS_STATUS_NOTFOUND;
+ break;
}
- else
- status = (errno == ECONNREFUSED
- ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
+
*herrnop = h_errno;
if (h_errno == TRY_AGAIN)
*errnop = EAGAIN;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 4c590babae..5c725b5f67 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2002,2004,2007,2008,2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1996-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
diff --git a/resolv/res-state.c b/resolv/res-state.c
index 3a2a4d5649..e53ba51a26 100644
--- a/resolv/res-state.c
+++ b/resolv/res-state.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 97, 98, 2002, 2003, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2013 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
diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c
index d23c9b9035..8ac46380a3 100644
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993,1995-2006,2007,2009,2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1993-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@azstarnet.com).
diff --git a/resolv/res_hconf.h b/resolv/res_hconf.h
index 90c56eb61a..ea207ab668 100644
--- a/resolv/res_hconf.h
+++ b/resolv/res_hconf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-1998, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@azstarnet.com).
diff --git a/resolv/res_query.c b/resolv/res_query.c
index abccd4a921..1325f9772d 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp,
int *resplen2)
{
HEADER *hp = (HEADER *) answer;
+ HEADER *hp2;
int n, use_malloc = 0;
u_int oflags = statp->_flags;
@@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp,
/* __libc_res_nsend might have reallocated the buffer. */
hp = (HEADER *) *answerp;
- /* We simplify the following tests by assigning HP to HP2. It
- is easy to verify that this is the same as ignoring all
- tests of HP2. */
- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
-
- if (n < (int) sizeof (HEADER) && answerp2 != NULL
- && *resplen2 > (int) sizeof (HEADER))
+ /* We simplify the following tests by assigning HP to HP2 or
+ vice versa. It is easy to verify that this is the same as
+ ignoring all tests of HP or HP2. */
+ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
{
- /* Special case of partial answer. */
- assert (hp != hp2);
- hp = hp2;
+ hp2 = hp;
}
- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
- && n > (int) sizeof (HEADER))
+ else
{
- /* Special case of partial answer. */
- assert (hp != hp2);
- hp2 = hp;
+ hp2 = (HEADER *) *answerp2;
+ if (n < (int) sizeof (HEADER))
+ {
+ hp = hp2;
+ }
}
+ /* Make sure both hp and hp2 are defined */
+ assert((hp != NULL) && (hp2 != NULL));
+
if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
&& (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
#ifdef DEBUG
diff --git a/resolv/tst-leaks.c b/resolv/tst-leaks.c
index 4e47a6a121..7a1183819b 100644
--- a/resolv/tst-leaks.c
+++ b/resolv/tst-leaks.c
@@ -1,5 +1,5 @@
/* Tests for res_query in libresolv
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003-2013 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
diff --git a/resolv/tst-leaks2.c b/resolv/tst-leaks2.c
index b098e8af5d..582000a899 100644
--- a/resolv/tst-leaks2.c
+++ b/resolv/tst-leaks2.c
@@ -1,5 +1,5 @@
/* Tests for res_init in libresolv
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004-2013 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