diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2017-02-09 20:14:42 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2017-02-09 20:14:42 +0000 |
commit | 9c147d58d1ab1e7a36fbdaacd50bf0474e724b97 (patch) | |
tree | c77d339652e014feefd36a86f2df4837bf570a8d /usr.bin | |
parent | 2423f93accf03edce5e2c0de8fec2b4cd4a92cea (diff) |
When getaddrinfo fails, print the requested host and port.
Should make debugging easier, especially when using -x literal_ipv6_address
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/nc/netcat.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c index adc1e1532ae..653b61a2a71 100644 --- a/usr.bin/nc/netcat.c +++ b/usr.bin/nc/netcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.175 2017/02/08 18:44:50 bluhm Exp $ */ +/* $OpenBSD: netcat.c,v 1.176 2017/02/09 20:14:41 jca Exp $ */ /* * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> * Copyright (c) 2015 Bob Beck. All rights reserved. @@ -867,7 +867,8 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) int s = -1, error, on = 1, save_errno; if ((error = getaddrinfo(host, port, &hints, &res0))) - errx(1, "getaddrinfo: %s", gai_strerror(error)); + errx(1, "getaddrinfo for host \"%s\" port %s: %s", host, + port, gai_strerror(error)); for (res = res0; res; res = res->ai_next) { if ((s = socket(res->ai_family, res->ai_socktype | |