summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/fake-getaddrinfo.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/openbsd-compat/fake-getaddrinfo.c b/openbsd-compat/fake-getaddrinfo.c
index e04776606..bc58f30a6 100644
--- a/openbsd-compat/fake-getaddrinfo.c
+++ b/openbsd-compat/fake-getaddrinfo.c
@@ -12,7 +12,7 @@
12#include "includes.h" 12#include "includes.h"
13#include "ssh.h" 13#include "ssh.h"
14 14
15RCSID("$Id: fake-getaddrinfo.c,v 1.4 2003/02/24 01:35:09 djm Exp $"); 15RCSID("$Id: fake-getaddrinfo.c,v 1.4.2.1 2003/03/26 05:03:06 djm Exp $");
16 16
17#ifndef HAVE_GAI_STRERROR 17#ifndef HAVE_GAI_STRERROR
18char *gai_strerror(int ecode) 18char *gai_strerror(int ecode)
@@ -71,6 +71,7 @@ int getaddrinfo(const char *hostname, const char *servname,
71 struct in_addr in; 71 struct in_addr in;
72 int i; 72 int i;
73 long int port; 73 long int port;
74 u_long addr;
74 75
75 port = 0; 76 port = 0;
76 if (servname != NULL) { 77 if (servname != NULL) {
@@ -86,7 +87,10 @@ int getaddrinfo(const char *hostname, const char *servname,
86 } 87 }
87 88
88 if (hints && hints->ai_flags & AI_PASSIVE) { 89 if (hints && hints->ai_flags & AI_PASSIVE) {
89 if (NULL != (*res = malloc_ai(port, htonl(0x00000000)))) 90 addr = htonl(0x00000000);
91 if (hostname && inet_aton(hostname, &in) != 0)
92 addr = in.s_addr;
93 if (NULL != (*res = malloc_ai(port, addr)))
90 return 0; 94 return 0;
91 else 95 else
92 return EAI_MEMORY; 96 return EAI_MEMORY;