git: 9front

Download patch

ref: 1b71fc55319ff41a64a440a3264c73d97df8346f
parent: ee5f835847688d30671612abcb1032df7f53e3ea
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Wed Jan 9 01:08:29 EST 2013

ape: fix getsockname() byte swaped ports (by yarikos)

APE's getsockname() returns port with bytes swapped (on 386).

--- a/sys/src/ape/lib/bsd/_sock_ingetaddr.c
+++ b/sys/src/ape/lib/bsd/_sock_ingetaddr.c
@@ -35,7 +35,7 @@
 			if(p){
 				*p++ = 0;
 				ip->sin_family = AF_INET;
-				ip->sin_port = atoi(p);
+				ip->sin_port = htons(atoi(p));
 				ip->sin_addr.s_addr = inet_addr(name);
 				if(alen)
 					*alen = sizeof(struct sockaddr_in);
--