[BACK]Return to network.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / telnet

Diff for /src/usr.bin/telnet/network.c between version 1.8 and 1.9

version 1.8, 2003/06/03 02:56:18 version 1.9, 2013/04/21 09:51:24
Line 61 
Line 61 
     int      int
 stilloob()  stilloob()
 {  {
     static struct timeval timeout = { 0 };      struct pollfd pfd[1];
     fd_set *fdsp;  
     int fdsn;  
     int value;      int value;
   
     fdsn = howmany(net+1, NFDBITS) * sizeof(fd_mask);  
     if ((fdsp = (fd_set *)malloc(fdsn)) == NULL)  
         err(1, "malloc");  
   
     do {      do {
         memset(fdsp, 0, fdsn);          pfd[0].fd = net;
         FD_SET(net, fdsp);          pfd[0].events = POLLRDBAND;
         value = select(net+1, (fd_set *)0, (fd_set *)0, fdsp, &timeout);          value = poll(pfd, 1, 0);
     } while ((value == -1) && (errno == EINTR));      } while ((value == -1) && (errno == EINTR));
   
     if (value < 0) {      if (value < 0) {
         perror("select");          perror("poll");
         free(fdsp);  
         (void) quit();          (void) quit();
         /* NOTREACHED */          /* NOTREACHED */
     }      }
     if (FD_ISSET(net, fdsp)) {      if (pfd[0].revents & POLLRDBAND)
         free(fdsp);  
         return 1;          return 1;
     } else {      else
         free(fdsp);  
         return 0;          return 0;
     }  
 }  }
   
   

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9