diff options
author | Darren Tucker <dtucker@zip.com.au> | 2007-12-29 02:43:51 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2007-12-29 02:43:51 +1100 |
commit | 4abde771b73f3a54780ff3dedf59f57f94298870 (patch) | |
tree | 7973cf3fd2910dac0e8db591f690750d19fd4421 /channels.c | |
parent | 88b976f214e14da4ec29a7516d02c0141c8ef597 (diff) |
- dtucker@cvs.openbsd.org 2007/12/27 14:22:08
[servconf.c canohost.c misc.c channels.c sshconnect.c misc.h ssh-keyscan.c
sshd.c]
Add a small helper function to consistently handle the EAI_SYSTEM error
code of getaddrinfo. Prompted by vgiffin at apple com via bz #1417.
ok markus@ stevesk@
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/channels.c b/channels.c index 2006353d4..25ebe1294 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.270 2007/06/25 08:20:03 dtucker Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.271 2007/12/27 14:22:08 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -2409,10 +2409,11 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por | |||
2409 | if (addr == NULL) { | 2409 | if (addr == NULL) { |
2410 | /* This really shouldn't happen */ | 2410 | /* This really shouldn't happen */ |
2411 | packet_disconnect("getaddrinfo: fatal error: %s", | 2411 | packet_disconnect("getaddrinfo: fatal error: %s", |
2412 | gai_strerror(r)); | 2412 | ssh_gai_strerror(r)); |
2413 | } else { | 2413 | } else { |
2414 | error("channel_setup_fwd_listener: " | 2414 | error("channel_setup_fwd_listener: " |
2415 | "getaddrinfo(%.64s): %s", addr, gai_strerror(r)); | 2415 | "getaddrinfo(%.64s): %s", addr, |
2416 | ssh_gai_strerror(r)); | ||
2416 | } | 2417 | } |
2417 | return 0; | 2418 | return 0; |
2418 | } | 2419 | } |
@@ -2732,7 +2733,7 @@ connect_to(const char *host, u_short port) | |||
2732 | snprintf(strport, sizeof strport, "%d", port); | 2733 | snprintf(strport, sizeof strport, "%d", port); |
2733 | if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) { | 2734 | if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) { |
2734 | error("connect_to %.100s: unknown host (%s)", host, | 2735 | error("connect_to %.100s: unknown host (%s)", host, |
2735 | gai_strerror(gaierr)); | 2736 | ssh_gai_strerror(gaierr)); |
2736 | return -1; | 2737 | return -1; |
2737 | } | 2738 | } |
2738 | for (ai = aitop; ai; ai = ai->ai_next) { | 2739 | for (ai = aitop; ai; ai = ai->ai_next) { |
@@ -2874,7 +2875,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
2874 | hints.ai_socktype = SOCK_STREAM; | 2875 | hints.ai_socktype = SOCK_STREAM; |
2875 | snprintf(strport, sizeof strport, "%d", port); | 2876 | snprintf(strport, sizeof strport, "%d", port); |
2876 | if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) { | 2877 | if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) { |
2877 | error("getaddrinfo: %.100s", gai_strerror(gaierr)); | 2878 | error("getaddrinfo: %.100s", ssh_gai_strerror(gaierr)); |
2878 | return -1; | 2879 | return -1; |
2879 | } | 2880 | } |
2880 | for (ai = aitop; ai; ai = ai->ai_next) { | 2881 | for (ai = aitop; ai; ai = ai->ai_next) { |
@@ -3047,7 +3048,8 @@ x11_connect_display(void) | |||
3047 | hints.ai_socktype = SOCK_STREAM; | 3048 | hints.ai_socktype = SOCK_STREAM; |
3048 | snprintf(strport, sizeof strport, "%u", 6000 + display_number); | 3049 | snprintf(strport, sizeof strport, "%u", 6000 + display_number); |
3049 | if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { | 3050 | if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { |
3050 | error("%.100s: unknown host. (%s)", buf, gai_strerror(gaierr)); | 3051 | error("%.100s: unknown host. (%s)", buf, |
3052 | ssh_gai_strerror(gaierr)); | ||
3051 | return -1; | 3053 | return -1; |
3052 | } | 3054 | } |
3053 | for (ai = aitop; ai; ai = ai->ai_next) { | 3055 | for (ai = aitop; ai; ai = ai->ai_next) { |