=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/telnet/commands.c,v retrieving revision 1.86 retrieving revision 1.87 diff -c -r1.86 -r1.87 *** src/usr.bin/telnet/commands.c 2018/09/30 14:35:32 1.86 --- src/usr.bin/telnet/commands.c 2019/06/28 13:35:04 1.87 *************** *** 1,4 **** ! /* $OpenBSD: commands.c,v 1.86 2018/09/30 14:35:32 deraadt Exp $ */ /* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: commands.c,v 1.87 2019/06/28 13:35:04 deraadt Exp $ */ /* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */ /* *************** *** 1841,1847 **** printf("Trying %s...\r\n", hbuf); } net = socket(res->ai_family, res->ai_socktype, res->ai_protocol); ! if (net < 0) continue; if (aliasp) { --- 1841,1847 ---- printf("Trying %s...\r\n", hbuf); } net = socket(res->ai_family, res->ai_socktype, res->ai_protocol); ! if (net == -1) continue; if (aliasp) { *************** *** 1858,1864 **** net = -1; continue; } ! if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) { perror(aliasp); (void) close(net); /* dump descriptor */ net = -1; --- 1858,1864 ---- net = -1; continue; } ! if (bind(net, ares->ai_addr, ares->ai_addrlen) == -1) { perror(aliasp); (void) close(net); /* dump descriptor */ net = -1; *************** *** 1870,1887 **** switch (res->ai_family) { case AF_INET: ! if (setsockopt(net, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0 && errno != ENOPROTOOPT) perror("telnet: setsockopt (IP_TOS) (ignored)"); break; case AF_INET6: if (setsockopt(net, IPPROTO_IPV6, IPV6_TCLASS, &tos, ! sizeof(tos)) < 0 && errno != ENOPROTOOPT) perror("telnet: setsockopt (IPV6_TCLASS) (ignored)"); break; } ! if (connect(net, res->ai_addr, res->ai_addrlen) < 0) { char hbuf[NI_MAXHOST]; if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), --- 1870,1887 ---- switch (res->ai_family) { case AF_INET: ! if (setsockopt(net, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1 && errno != ENOPROTOOPT) perror("telnet: setsockopt (IP_TOS) (ignored)"); break; case AF_INET6: if (setsockopt(net, IPPROTO_IPV6, IPV6_TCLASS, &tos, ! sizeof(tos)) == -1 && errno != ENOPROTOOPT) perror("telnet: setsockopt (IPV6_TCLASS) (ignored)"); break; } ! if (connect(net, res->ai_addr, res->ai_addrlen) == -1) { char hbuf[NI_MAXHOST]; if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),