Skip to content

Commit

Permalink
Fix getaddrinfo failing with EAI_HINTS on FreeBSD
Browse files Browse the repository at this point in the history
This fixes spectest failures (e.g. in S32-io/IO-Socket-INET.t) on FreeBSD.

According to the man page of getaddrinfo() '[a]ll other elements of the
addrinfo structure passed via hints must be zero or the null pointer'
(similiar wording on Linux). This requirement is actually enforced on
FreeBSD:

  https://github.com/freebsd/freebsd/blob/89c48e12204df05d7db296d3ae5d2fd002b4b510/lib/libc/net/getaddrinfo.c#L429
  • Loading branch information
usev6 committed Oct 1, 2017
1 parent 89ca8eb commit d04c8dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/io/syncsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ struct sockaddr * MVM_io_resolve_host_name(MVMThreadContext *tc, MVMString *host
hints.ai_socktype = 0;
hints.ai_flags = AI_PASSIVE;
hints.ai_protocol = 0;
hints.ai_addrlen = 0;
hints.ai_addr = NULL;
hints.ai_canonname = NULL;
hints.ai_next = NULL;

snprintf(port_cstr, 8, "%d", (int)port);

Expand Down

0 comments on commit d04c8dc

Please sign in to comment.