summaryrefslogtreecommitdiffstats
path: root/gl/getaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/getaddrinfo.c')
-rw-r--r--gl/getaddrinfo.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index f523f76..04f0ac2 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -1,11 +1,11 @@
1/* Get address information (partial implementation). 1/* Get address information (partial implementation).
2 Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software 2 Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 Contributed by Simon Josefsson <simon@josefsson.org>. 4 Contributed by Simon Josefsson <simon@josefsson.org>.
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option) 8 the Free Software Foundation; either version 3, or (at your option)
9 any later version. 9 any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
@@ -28,9 +28,12 @@
28/* Get calloc. */ 28/* Get calloc. */
29#include <stdlib.h> 29#include <stdlib.h>
30 30
31/* Get memcpy. */ 31/* Get memcpy, strdup. */
32#include <string.h> 32#include <string.h>
33 33
34/* Get snprintf. */
35#include <stdio.h>
36
34#include <stdbool.h> 37#include <stdbool.h>
35 38
36#include "gettext.h" 39#include "gettext.h"
@@ -38,8 +41,6 @@
38#define N_(String) String 41#define N_(String) String
39 42
40#include "inet_ntop.h" 43#include "inet_ntop.h"
41#include "snprintf.h"
42#include "strdup.h"
43 44
44/* BeOS has AF_INET, but not PF_INET. */ 45/* BeOS has AF_INET, but not PF_INET. */
45#ifndef PF_INET 46#ifndef PF_INET
@@ -178,7 +179,7 @@ getaddrinfo (const char *restrict nodename,
178 const char *proto = 179 const char *proto =
179 (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp"; 180 (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
180 181
181 if (!(hints->ai_flags & AI_NUMERICSERV)) 182 if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
182 /* FIXME: Use getservbyname_r if available. */ 183 /* FIXME: Use getservbyname_r if available. */
183 se = getservbyname (servname, proto); 184 se = getservbyname (servname, proto);
184 185