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

Diff for /src/usr.bin/ssh/misc.c between version 1.142 and 1.143

version 1.142, 2019/09/03 08:32:11 version 1.143, 2019/11/22 06:50:30
Line 211 
Line 211 
 }  }
   
 /*  /*
  * Wait up to *timeoutp milliseconds for fd to be readable. Updates   * Wait up to *timeoutp milliseconds for events on fd. Updates
  * *timeoutp with time remaining.   * *timeoutp with time remaining.
  * Returns 0 if fd ready or -1 on timeout or error (see errno).   * Returns 0 if fd ready or -1 on timeout or error (see errno).
  */   */
 int  static int
 waitrfd(int fd, int *timeoutp)  waitfd(int fd, int *timeoutp, short events)
 {  {
         struct pollfd pfd;          struct pollfd pfd;
         struct timeval t_start;          struct timeval t_start;
Line 224 
Line 224 
   
         monotime_tv(&t_start);          monotime_tv(&t_start);
         pfd.fd = fd;          pfd.fd = fd;
         pfd.events = POLLIN;          pfd.events = events;
         for (; *timeoutp >= 0;) {          for (; *timeoutp >= 0;) {
                 r = poll(&pfd, 1, *timeoutp);                  r = poll(&pfd, 1, *timeoutp);
                 oerrno = errno;                  oerrno = errno;
Line 243 
Line 243 
 }  }
   
 /*  /*
    * Wait up to *timeoutp milliseconds for fd to be readable. Updates
    * *timeoutp with time remaining.
    * Returns 0 if fd ready or -1 on timeout or error (see errno).
    */
   int
   waitrfd(int fd, int *timeoutp) {
           return waitfd(fd, timeoutp, POLLIN);
   }
   
   /*
  * Attempt a non-blocking connect(2) to the specified address, waiting up to   * Attempt a non-blocking connect(2) to the specified address, waiting up to
  * *timeoutp milliseconds for the connection to complete. If the timeout is   * *timeoutp milliseconds for the connection to complete. If the timeout is
  * <=0, then wait indefinitely.   * <=0, then wait indefinitely.
Line 268 
Line 278 
         } else if (errno != EINPROGRESS)          } else if (errno != EINPROGRESS)
                 return -1;                  return -1;
   
         if (waitrfd(sockfd, timeoutp) == -1)          if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT) == -1)
                 return -1;                  return -1;
   
         /* Completed or failed */          /* Completed or failed */

Legend:
Removed from v.1.142  
changed lines
  Added in v.1.143