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

Diff for /src/usr.bin/ftp/ftp.c between version 1.53 and 1.54

version 1.53, 2003/06/03 02:56:08 version 1.54, 2003/08/11 21:23:58
Line 82 
Line 82 
 #include <err.h>  #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <netdb.h>  #include <netdb.h>
   #include <poll.h>
   #include <stdarg.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
 #include <utime.h>  #include <utime.h>
 #include <stdarg.h>  
   
 #include "ftp_var.h"  #include "ftp_var.h"
   
Line 449 
Line 450 
         }          }
 }  }
   
 int  
 empty(mask, sec)  
         fd_set *mask;  
         int sec;  
 {  
         struct timeval t;  
   
         t.tv_sec = (long) sec;  
         t.tv_usec = 0;  
         return (select(32, mask, (fd_set *) 0, (fd_set *) 0, &t));  
 }  
   
 jmp_buf sendabort;  jmp_buf sendabort;
   
 void  void
Line 1697 
Line 1686 
         int prox_type, nfnd;          int prox_type, nfnd;
         volatile int secndflag;          volatile int secndflag;
         char * volatile cmd2;          char * volatile cmd2;
         fd_set mask;          struct pollfd pfd[1];
   
         oldintr = NULL;          oldintr = NULL;
         secndflag = 0;          secndflag = 0;
Line 1791 
Line 1780 
                 abort_remote(NULL);                  abort_remote(NULL);
         pswitch(!proxy);          pswitch(!proxy);
         if (cpend) {          if (cpend) {
                 FD_ZERO(&mask);                  pfd[0].fd = fileno(cin);
                 FD_SET(fileno(cin), &mask);                  pfd[0].events = POLLIN;
                 if ((nfnd = empty(&mask, 10)) <= 0) {                  if ((nfnd = poll(pfd, 1, 10 * 1000)) <= 0) {
                         if (nfnd < 0) {                          if (nfnd < 0)
                                 warn("abort");                                  warn("abort");
                         }  
                         if (ptabflg)                          if (ptabflg)
                                 code = -1;                                  code = -1;
                         lostpeer();                          lostpeer();
Line 1817 
Line 1805 
         int argc;          int argc;
         char *argv[];          char *argv[];
 {  {
         fd_set mask;          struct pollfd pfd[1];
         int nfnd = 1;          int nfnd = 1;
   
         FD_ZERO(&mask);          pfd[0].fd = fileno(cin);
           pfd[0].events = POLLIN;
         while (nfnd > 0) {          while (nfnd > 0) {
                 FD_SET(fileno(cin), &mask);                  if ((nfnd = poll(pfd, 1, 0)) < 0) {
                 if ((nfnd = empty(&mask, 0)) < 0) {  
                         warn("reset");                          warn("reset");
                         code = -1;                          code = -1;
                         lostpeer();                          lostpeer();
                 }                  } else if (nfnd) {
                 else if (nfnd) {  
                         (void)getreply(0);                          (void)getreply(0);
                 }                  }
         }          }
Line 1886 
Line 1873 
 {  {
         char buf[BUFSIZ];          char buf[BUFSIZ];
         int nfnd;          int nfnd;
         fd_set mask;          struct pollfd pfd[2];
   
         if (cout == NULL) {          if (cout == NULL) {
                 warnx("Lost control connection for abort.");                  warnx("Lost control connection for abort.");
Line 1905 
Line 1892 
                 warn("abort");                  warn("abort");
         fprintf(cout, "%cABOR\r\n", DM);          fprintf(cout, "%cABOR\r\n", DM);
         (void)fflush(cout);          (void)fflush(cout);
         FD_ZERO(&mask);          pfd[0].fd = fileno(cin);
         FD_SET(fileno(cin), &mask);          pfd[0].events = POLLIN;
           nfnd = 1;
         if (din) {          if (din) {
                 FD_SET(fileno(din), &mask);                  pfd[1].fd = fileno(din);
                   pfd[1].events = POLLIN;
                   nfnd++;
         }          }
         if ((nfnd = empty(&mask, 10)) <= 0) {          if ((nfnd = poll(pfd, nfnd, 10 * 1000)) <= 0) {
                 if (nfnd < 0) {                  if (nfnd < 0)
                         warn("abort");                          warn("abort");
                 }  
                 if (ptabflg)                  if (ptabflg)
                         code = -1;                          code = -1;
                 lostpeer();                  lostpeer();
         }          }
         if (din && FD_ISSET(fileno(din), &mask)) {          if (din && (pfd[1].revents & POLLIN)) {
                 while (read(fileno(din), buf, BUFSIZ) > 0)                  while (read(fileno(din), buf, BUFSIZ) > 0)
                         /* LOOP */;                          /* LOOP */;
         }          }

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54