summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2006-01-14 21:21:46 +0000
committerotto <otto@openbsd.org>2006-01-14 21:21:46 +0000
commit9ecfbc1e220ee3f60210290b5fb7d0e5ab3724e5 (patch)
tree9ee73863e41dcabddae78364c65a954a31160d5d
parentAdd a -q flag to reduce output a la newfs, and print the raw device we are (diff)
downloadwireguard-openbsd-9ecfbc1e220ee3f60210290b5fb7d0e5ab3724e5.tar.xz
wireguard-openbsd-9ecfbc1e220ee3f60210290b5fb7d0e5ab3724e5.zip
Properly handle failure binding to a local interface (using the -b
option). Problem found by David Hill <dhill at mindcry dot org>; ok millert@
-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;
}