aboutsummaryrefslogtreecommitdiff
path: root/toys/net
diff options
context:
space:
mode:
Diffstat (limited to 'toys/net')
-rw-r--r--toys/net/netcat.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/net/netcat.c b/toys/net/netcat.c
index 761d1f2a..57304f44 100644
--- a/toys/net/netcat.c
+++ b/toys/net/netcat.c
@@ -125,6 +125,10 @@ void netcat_main(void)
} else {
size_t bind_addrlen;
+ // If we weren't given an address with which to resolve which family to
+ // use, we have to choose.
+ if (family == AF_UNSPEC) family = AF_INET;
+
address->sa_family = family;
if (family == AF_INET6) {