summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjca <>2017-02-09 20:14:41 +0000
committerjca <>2017-02-09 20:14:41 +0000
commitf2f2b6d58d42fcda92b273d7e6faddd2bf65fd11 (patch)
treeaa6c725c8d10e698454134099557670d9e3c0863 /src
parentbc047f5237e81843012b06739757d793a5958066 (diff)
downloadopenbsd-f2f2b6d58d42fcda92b273d7e6faddd2bf65fd11.tar.gz
openbsd-f2f2b6d58d42fcda92b273d7e6faddd2bf65fd11.tar.bz2
openbsd-f2f2b6d58d42fcda92b273d7e6faddd2bf65fd11.zip
When getaddrinfo fails, print the requested host and port.
Should make debugging easier, especially when using -x literal_ipv6_address
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/nc/netcat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index adc1e1532a..653b61a2a7 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.175 2017/02/08 18:44:50 bluhm Exp $ */ 1/* $OpenBSD: netcat.c,v 1.176 2017/02/09 20:14:41 jca Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * Copyright (c) 2015 Bob Beck. All rights reserved. 4 * Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -867,7 +867,8 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
867 int s = -1, error, on = 1, save_errno; 867 int s = -1, error, on = 1, save_errno;
868 868
869 if ((error = getaddrinfo(host, port, &hints, &res0))) 869 if ((error = getaddrinfo(host, port, &hints, &res0)))
870 errx(1, "getaddrinfo: %s", gai_strerror(error)); 870 errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
871 port, gai_strerror(error));
871 872
872 for (res = res0; res; res = res->ai_next) { 873 for (res = res0; res; res = res->ai_next) {
873 if ((s = socket(res->ai_family, res->ai_socktype | 874 if ((s = socket(res->ai_family, res->ai_socktype |