Windows *does* have getservbyname, no matter what autoconf says.

TODO: figure out why autoconf is confused about this.

svn:r1538
This commit is contained in:
Nick Mathewson 2009-11-17 02:38:19 +00:00
parent 86f5742015
commit 888007f9a4
3 changed files with 10 additions and 7 deletions

View File

@ -171,7 +171,7 @@ die horribly
AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
if test x$bwin32 = xtrue; then
LIBS="$LIBS -lws2_32"
AC_SEARCH_LIBS([getservbyname],[ws2_32])
fi
dnl Checks for typedefs, structures, and compiler characteristics.

View File

@ -502,7 +502,7 @@ evutil_parse_servname(const char *servname, const char *protocol,
n = (int) strtol(servname, &endptr, 10);
if (n>=0 && n <= 65535 && servname[0] && endptr && !endptr[0])
return n;
#ifdef _EVENT_HAVE_GETSERVBYNAME
#if defined(_EVENT_HAVE_GETSERVBYNAME) || defined(WIN32)
if (!(hints->ai_flags & EVUTIL_AI_NUMERICSERV)) {
struct servent *ent = getservbyname(servname, protocol);
if (ent) {

View File

@ -1183,11 +1183,14 @@ test_getaddrinfo_async(void *arg)
r = evdns_getaddrinfo(dns_base, "1.2.3.4", "http",
&hints, gai_cb, &local_outcome);
tt_int_op(r,==,0);
tt_int_op(local_outcome.err,==,0);
tt_ptr_op(local_outcome.ai,!=,NULL);
test_ai_eq(local_outcome.ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP);
evutil_freeaddrinfo(local_outcome.ai);
local_outcome.ai = NULL;
if (!local_outcome.err) {
tt_ptr_op(local_outcome.ai,!=,NULL);
test_ai_eq(local_outcome.ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP);
evutil_freeaddrinfo(local_outcome.ai);
local_outcome.ai = NULL;
} else {
TT_BLATHER(("Apparently we have no getservbyname."));
}
/* 1b. EVUTIL_AI_NUMERICHOST is set */
memset(&hints, 0, sizeof(hints));