(tn): clean-up a tiny little bit. give-up if we do not manage to

connect to any address


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8078 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-03-28 05:21:54 +00:00
parent d0b3d79130
commit c3043e6c5e

View File

@@ -2063,7 +2063,6 @@ int
tn(int argc, char **argv) tn(int argc, char **argv)
{ {
struct servent *sp = 0; struct servent *sp = 0;
extern char *inet_ntoa();
#if defined(IP_OPTIONS) && defined(IPPROTO_IP) #if defined(IP_OPTIONS) && defined(IPPROTO_IP)
char *srp = 0; char *srp = 0;
int srlen; int srlen;
@@ -2192,7 +2191,7 @@ tn(int argc, char **argv)
net = socket (a->ai_family, a->ai_socktype, a->ai_protocol); net = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
setuid (getuid ()); setuid (getuid ());
if (net < 0) { if (net < 0) {
warn ("telnet: socket"); warn ("socket");
continue; continue;
} }
#if defined(IP_OPTIONS) && defined(IPPROTO_IP) && defined(HAVE_SETSOCKOPT) #if defined(IP_OPTIONS) && defined(IPPROTO_IP) && defined(HAVE_SETSOCKOPT)
@@ -2236,6 +2235,9 @@ tn(int argc, char **argv)
auth_encrypt_connect(connected); auth_encrypt_connect(connected);
#endif #endif
} }
freeaddrinfo (ai);
if (connected == 0)
return 0;
} }
cmdrc(hostp, hostname); cmdrc(hostp, hostname);
if (autologin && user == NULL) if (autologin && user == NULL)