aboutsummaryrefslogtreecommitdiff
path: root/tests/sockets/test_gethostbyname.c
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2013-09-05 09:26:42 +0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-13 10:07:03 -0700
commitb9c8b95795849264c58be7d1496da3c4078df96c (patch)
treed4e5ec70082f4c03347b7cccdbfde691ae385186 /tests/sockets/test_gethostbyname.c
parent2a60fa0c6f107959b754824a525a3d69294b9696 (diff)
gethostbyname_r update.
* gethostbyname_r is now the 6 arg version. * Make enet use the right code path (this should be upstreamed). * Add a compat header to make these declarations visible to all without extra compilation flags.
Diffstat (limited to 'tests/sockets/test_gethostbyname.c')
-rw-r--r--tests/sockets/test_gethostbyname.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/sockets/test_gethostbyname.c b/tests/sockets/test_gethostbyname.c
index de7da706..459c6b98 100644
--- a/tests/sockets/test_gethostbyname.c
+++ b/tests/sockets/test_gethostbyname.c
@@ -13,12 +13,17 @@
int main() {
char str[INET_ADDRSTRLEN];
+ struct hostent *host = NULL;
+ struct hostent hostData;
struct in_addr addr;
const char *res;
+ char buffer[2048];
int err;
- // resolve the hostname ot an actual address
- struct hostent *host = gethostbyname("slashdot.org");
+ // gethostbyname_r calls the same stuff as gethostbyname, so we'll test the
+ // more complicated one.
+ // resolve the hostname to an actual address
+ gethostbyname_r("slashdot.org", &hostData, buffer, sizeof(buffer), &host, &err);
assert(host->h_addrtype == AF_INET);
assert(host->h_length == sizeof(uint32_t));