=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/telnet/sys_bsd.c,v retrieving revision 1.34 retrieving revision 1.35 diff -c -r1.34 -r1.35 *** src/usr.bin/telnet/sys_bsd.c 2017/07/19 12:25:52 1.34 --- src/usr.bin/telnet/sys_bsd.c 2019/06/28 13:35:04 1.35 *************** *** 1,4 **** ! /* $OpenBSD: sys_bsd.c,v 1.34 2017/07/19 12:25:52 deraadt Exp $ */ /* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: sys_bsd.c,v 1.35 2019/06/28 13:35:04 deraadt Exp $ */ /* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */ /* *************** *** 355,361 **** sigprocmask(SIG_UNBLOCK, &mask, NULL); tmp_tc = old_tc; } ! if (isatty(tin) && tcsetattr(tin, TCSADRAIN, &tmp_tc) < 0) tcsetattr(tin, TCSANOW, &tmp_tc); ioctl(tin, FIONBIO, &onoff); --- 355,361 ---- sigprocmask(SIG_UNBLOCK, &mask, NULL); tmp_tc = old_tc; } ! if (isatty(tin) && tcsetattr(tin, TCSADRAIN, &tmp_tc) == -1) tcsetattr(tin, TCSANOW, &tmp_tc); ioctl(tin, FIONBIO, &onoff); *************** *** 381,387 **** { struct winsize ws; ! if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) >= 0) { *rows = ws.ws_row; *cols = ws.ws_col; return 1; --- 381,387 ---- { struct winsize ws; ! if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) == 0) { *rows = ws.ws_row; *cols = ws.ws_col; return 1; *************** *** 526,532 **** pfd[TELNET_FD_NET].fd = -1; } ! if ((c = poll(pfd, TELNET_FD_NUM, dopoll ? 0 : INFTIM)) < 0) { return 0; } --- 526,532 ---- pfd[TELNET_FD_NET].fd = -1; } ! if ((c = poll(pfd, TELNET_FD_NUM, dopoll ? 0 : INFTIM)) == -1) { return 0; } *************** *** 546,552 **** canread = ring_empty_consecutive(&netiring); c = recv(net, netiring.supply, canread, 0); ! if (c < 0 && errno == EWOULDBLOCK) { c = 0; } else if (c <= 0) { return -1; --- 546,552 ---- canread = ring_empty_consecutive(&netiring); c = recv(net, netiring.supply, canread, 0); ! if (c == -1 && errno == EWOULDBLOCK) { c = 0; } else if (c <= 0) { return -1; *************** *** 564,572 **** */ if (pfd[TELNET_FD_TIN].revents & (POLLIN|POLLHUP)) { c = read(tin, ttyiring.supply, ring_empty_consecutive(&ttyiring)); ! if (c < 0 && errno == EIO) c = 0; ! if (c < 0 && errno == EWOULDBLOCK) { c = 0; } else { /* EOF detection for line mode!!!! */ --- 564,572 ---- */ if (pfd[TELNET_FD_TIN].revents & (POLLIN|POLLHUP)) { c = read(tin, ttyiring.supply, ring_empty_consecutive(&ttyiring)); ! if (c == -1 && errno == EIO) c = 0; ! if (c == -1 && errno == EWOULDBLOCK) { c = 0; } else { /* EOF detection for line mode!!!! */