small fixes to ipv6 infrastructure
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index 65554b2..377e065 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -48,6 +48,7 @@
port_nr = bb_strtou(port, NULL, 10);
if (errno || port_nr > 65535) {
struct servent *tserv = getservbyname(port, protocol);
+ port_nr = default_port;
if (tserv)
port_nr = ntohs(tserv->s_port);
}
@@ -213,6 +214,7 @@
fd = xsocket(lsa->sa.sa_family, SOCK_STREAM, 0);
} else {
fd = xsocket_stream(&lsa);
+ set_nport(lsa, htons(port));
}
setsockopt_reuseaddr(fd);
xbind(fd, &lsa->sa, lsa->len);