summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-keyscan.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2015-01-28 21:15:47 +0000
committerdjm <djm@openbsd.org>2015-01-28 21:15:47 +0000
commit42dab86da22abd45f95f38eb79574fe392815094 (patch)
tree69b7033ce69bed3dc57c7105fe193c4a6a355911 /usr.bin/ssh/ssh-keyscan.c
parentClean up eqn(7) error handling: (diff)
downloadwireguard-openbsd-42dab86da22abd45f95f38eb79574fe392815094.tar.xz
wireguard-openbsd-42dab86da22abd45f95f38eb79574fe392815094.zip
avoid fatal() calls in packet code
makes ssh-keyscan more reliable against server failures ok dtucker@ markus@
Diffstat (limited to 'usr.bin/ssh/ssh-keyscan.c')
-rw-r--r--usr.bin/ssh/ssh-keyscan.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/ssh/ssh-keyscan.c b/usr.bin/ssh/ssh-keyscan.c
index 80a757e601f..e9e3cdef1cd 100644
--- a/usr.bin/ssh/ssh-keyscan.c
+++ b/usr.bin/ssh/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.96 2015/01/20 23:14:00 deraadt Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.97 2015/01/28 21:15:47 djm Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
*
@@ -301,8 +301,10 @@ tcpconnect(char *host)
memset(&hints, 0, sizeof(hints));
hints.ai_family = IPv4or6;
hints.ai_socktype = SOCK_STREAM;
- if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
- fatal("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));
+ if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
+ error("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));
+ return -1;
+ }
for (ai = aitop; ai; ai = ai->ai_next) {
s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (s < 0) {