summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-01-14 21:21:47 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-01-14 21:21:47 +0000
commit6f37fc1061a0e0a1258a76f7787f1f5afa71fb0c (patch)
treeb03ba7cad0ec648fb126c21fe0a1f194754ce168 /usr.bin
parent7f121358b3fd2d05447c7baf77745550da856f64 (diff)
Properly handle failure binding to a local interface (using the -b
option). Problem found by David Hill <dhill at mindcry dot org>; ok millert@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/telnet/commands.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 0642f4d5c6a..5a422036e57 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.48 2005/02/27 15:46:42 otto Exp $ */
+/* $OpenBSD: commands.c,v 1.49 2006/01/14 21:21:46 otto Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -2408,11 +2408,13 @@ tn(argc, argv)
if (error) {
warn("%s: %s", aliasp, gai_strerror(error));
close(net);
+ net = -1;
continue;
}
if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) {
perror(aliasp);
(void) close(net); /* dump descriptor */
+ net = -1;
freeaddrinfo(ares);
continue;
}