diff --git a/src/library.js b/src/library.js index ebcf7b789f9ef..20a5ed468ea4b 100644 --- a/src/library.js +++ b/src/library.js @@ -1073,7 +1073,7 @@ addToLibrary({ if (family === {{{ cDefs.AF_INET }}}) { addr = _htonl({{{ cDefs.INADDR_LOOPBACK }}}); } else { - addr = [0, 0, 0, 1]; + addr = [0, 0, 0, _htonl(1)]; } } ai = allocaddrinfo(family, type, proto, null, addr, port); diff --git a/test/sockets/test_getaddrinfo.c b/test/sockets/test_getaddrinfo.c index cb8663538513c..2cc13894cc8cf 100644 --- a/test/sockets/test_getaddrinfo.c +++ b/test/sockets/test_getaddrinfo.c @@ -122,10 +122,7 @@ int main() { print_addrinfo(servinfo); assert(servinfo->ai_family == AF_INET6); assert(servinfo->ai_socktype == SOCK_STREAM); -#ifndef __EMSCRIPTEN__ - // TODO(sbc): This assert currently fails under emscripten, but should not assert(memcmp(&sa6->sin6_addr, &in6addr_loopback, sizeof(in6addr_loopback)) == 0); -#endif assert(sa6->sin6_port == ntohs(81)); freeaddrinfo(servinfo);