aboutsummaryrefslogtreecommitdiff
path: root/gl/getaddrinfo.c
diff options
context:
space:
mode:
authorGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-08-19 23:27:12 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-08-19 23:27:12 +0200
commit26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch)
treec4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/getaddrinfo.c
parent5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff)
downloadmonitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/getaddrinfo.c')
-rw-r--r--gl/getaddrinfo.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index 6aa676c8..58d28115 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -1,5 +1,5 @@
/* Get address information (partial implementation).
- Copyright (C) 1997, 2001-2002, 2004-2010 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001-2002, 2004-2013 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
This program is free software; you can redistribute it and/or modify
@@ -13,15 +13,14 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <config.h>
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the sa == NULL test below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
#include <netdb.h>
#if HAVE_NETINET_IN_H
@@ -56,10 +55,13 @@
#endif
#if defined _WIN32 || defined __WIN32__
-# define WIN32_NATIVE
+# define WINDOWS_NATIVE
#endif
-#ifdef WIN32_NATIVE
+/* gl_sockets_startup */
+#include "sockets.h"
+
+#ifdef WINDOWS_NATIVE
typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
const struct addrinfo*,
struct addrinfo**);
@@ -101,11 +103,13 @@ use_win32_p (void)
return 0;
}
+ gl_sockets_startup (SOCKETS_1_1);
+
return 1;
}
#endif
-static inline bool
+static bool
validate_family (int family)
{
/* FIXME: Support more families. */
@@ -148,7 +152,7 @@ getaddrinfo (const char *restrict nodename,
};
#endif
-#ifdef WIN32_NATIVE
+#ifdef WINDOWS_NATIVE
if (use_win32_p ())
return getaddrinfo_ptr (nodename, servname, hints, res);
#endif
@@ -327,11 +331,11 @@ getaddrinfo (const char *restrict nodename,
return 0;
}
-/* Free `addrinfo' structure AI including associated storage. */
+/* Free 'addrinfo' structure AI including associated storage. */
void
freeaddrinfo (struct addrinfo *ai)
{
-#ifdef WIN32_NATIVE
+#ifdef WINDOWS_NATIVE
if (use_win32_p ())
{
freeaddrinfo_ptr (ai);
@@ -357,7 +361,7 @@ getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
char *restrict service, socklen_t servicelen,
int flags)
{
-#ifdef WIN32_NATIVE
+#ifdef WINDOWS_NATIVE
if (use_win32_p ())
return getnameinfo_ptr (sa, salen, node, nodelen,
service, servicelen, flags);