Commit f5f13b50ad07a2cf6829638aef4680c72b3a4f08

Patrick Steinhardt 2017-06-27T19:38:50

Merge pull request #4280 from ids1024/htons Convert port with htons() in p_getaddrinfo()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/posix.c b/src/posix.c
index 94deb6a..fd9188a 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -40,7 +40,7 @@ int p_getaddrinfo(
 	if (ainfo->ai_servent)
 		ainfo->ai_port = ainfo->ai_servent->s_port;
 	else
-		ainfo->ai_port = atol(port);
+		ainfo->ai_port = htons(atol(port));
 
 	memcpy(&ainfo->ai_addr_in.sin_addr,
 			ainfo->ai_hostent->h_addr_list[0],