=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/telnet/network.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- src/usr.bin/telnet/network.c 1996/12/12 11:35:59 1.3 +++ src/usr.bin/telnet/network.c 1997/12/16 22:07:38 1.4 @@ -1,4 +1,4 @@ -/* $OpenBSD: network.c,v 1.3 1996/12/12 11:35:59 robin Exp $ */ +/* $OpenBSD: network.c,v 1.4 1997/12/16 22:07:38 deraadt Exp $ */ /* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */ /* @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93"; static char rcsid[] = "$NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: network.c,v 1.3 1996/12/12 11:35:59 robin Exp $"; +static char rcsid[] = "$OpenBSD: network.c,v 1.4 1997/12/16 22:07:38 deraadt Exp $"; #endif #endif /* not lint */ @@ -86,23 +86,31 @@ stilloob() { static struct timeval timeout = { 0 }; - fd_set excepts; + fd_set *fdsp; + int fdsn; int value; + fdsn = howmany(net+1, NFDBITS) * sizeof(fd_mask); + if ((fdsp = (fd_set *)malloc(fdsn)) == NULL) + err(1, "malloc"); + do { - FD_ZERO(&excepts); - FD_SET(net, &excepts); - value = select(net+1, (fd_set *)0, (fd_set *)0, &excepts, &timeout); + memset(fdsp, 0, fdsn); + FD_SET(net, fdsp); + value = select(net+1, (fd_set *)0, (fd_set *)0, fdsp, &timeout); } while ((value == -1) && (errno == EINTR)); if (value < 0) { perror("select"); + free(fdsp); (void) quit(); /* NOTREACHED */ } - if (FD_ISSET(net, &excepts)) { + if (FD_ISSET(net, fdsp)) { + free(fdsp); return 1; } else { + free(fdsp); return 0; } }