Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153446610
D19026.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D19026.id.diff
View Options
Index: head/lib/libc/tests/sys/sendfile_test.c
===================================================================
--- head/lib/libc/tests/sys/sendfile_test.c
+++ head/lib/libc/tests/sys/sendfile_test.c
@@ -97,22 +97,31 @@
static void
resolve_localhost(struct addrinfo **res, int domain, int type, int port)
{
+ const char *host;
char *serv;
struct addrinfo hints;
int error;
- ATF_REQUIRE_MSG(domain == AF_INET || domain == AF_INET6,
- "unhandled domain: %d", domain);
+ switch (domain) {
+ case AF_INET:
+ host = "127.0.0.1";
+ break;
+ case AF_INET6:
+ host = "::1";
+ break;
+ default:
+ atf_tc_fail("unhandled domain: %d", domain);
+ }
ATF_REQUIRE_MSG(asprintf(&serv, "%d", port) >= 0,
"asprintf failed: %s", strerror(errno));
memset(&hints, 0, sizeof(hints));
hints.ai_family = domain;
- hints.ai_flags = AI_ADDRCONFIG|AI_NUMERICSERV;
+ hints.ai_flags = AI_ADDRCONFIG|AI_NUMERICSERV|AI_NUMERICHOST;
hints.ai_socktype = type;
- error = getaddrinfo("localhost", serv, &hints, res);
+ error = getaddrinfo(host, serv, &hints, res);
ATF_REQUIRE_EQ_MSG(error, 0,
"getaddrinfo failed: %s", gai_strerror(error));
free(serv);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 5:34 AM (16 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31956367
Default Alt Text
D19026.id.diff (1 KB)
Attached To
Mode
D19026: Avoid the DNS lookup for "localhost"
Attached
Detach File
Event Timeline
Log In to Comment