diff options
author | Rob Landley <rob@landley.net> | 2019-01-02 19:02:32 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-01-02 19:02:32 -0600 |
commit | e95778682ac4d2f71781ac39a83f9346861b3675 (patch) | |
tree | a5f257ac7989e0966edd208c745aacca0b108875 /toys/net/netcat.c | |
parent | 67a2b56b77bf17d73fa7cf0336fd15f16924cd61 (diff) | |
download | toybox-e95778682ac4d2f71781ac39a83f9346861b3675.tar.gz |
Josh Gao said "netcat -l -p 12345" broke:
Previously, when trying to listen on a socket without using one of -4,
-6, or -s, we tried to create an AF_UNSPEC socket, which fails.
Diffstat (limited to 'toys/net/netcat.c')
-rw-r--r-- | toys/net/netcat.c | 4 |
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) { |