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

Diff for /src/usr.bin/ssh/sftp-client.c between version 1.47.2.2 and 1.48

version 1.47.2.2, 2005/03/10 17:15:04 version 1.48, 2004/03/30 12:41:56
Line 36 
Line 36 
 #include "sftp-common.h"  #include "sftp-common.h"
 #include "sftp-client.h"  #include "sftp-client.h"
   
 extern volatile sig_atomic_t interrupted;  
 extern int showprogress;  extern int showprogress;
   
 /* Minimum amount of data to read at at time */  /* Minimum amount of data to read at at time */
Line 172 
Line 171 
                 int status = buffer_get_int(&msg);                  int status = buffer_get_int(&msg);
   
                 error("Couldn't get handle: %s", fx2txt(status));                  error("Couldn't get handle: %s", fx2txt(status));
                 buffer_free(&msg);  
                 return(NULL);                  return(NULL);
         } else if (type != SSH2_FXP_HANDLE)          } else if (type != SSH2_FXP_HANDLE)
                 fatal("Expected SSH2_FXP_HANDLE(%u) packet, got %u",                  fatal("Expected SSH2_FXP_HANDLE(%u) packet, got %u",
Line 207 
Line 205 
                         debug("Couldn't stat remote file: %s", fx2txt(status));                          debug("Couldn't stat remote file: %s", fx2txt(status));
                 else                  else
                         error("Couldn't stat remote file: %s", fx2txt(status));                          error("Couldn't stat remote file: %s", fx2txt(status));
                 buffer_free(&msg);  
                 return(NULL);                  return(NULL);
         } else if (type != SSH2_FXP_ATTRS) {          } else if (type != SSH2_FXP_ATTRS) {
                 fatal("Expected SSH2_FXP_ATTRS(%u) packet, got %u",                  fatal("Expected SSH2_FXP_ATTRS(%u) packet, got %u",
Line 333 
Line 330 
                 (*dir)[0] = NULL;                  (*dir)[0] = NULL;
         }          }
   
         for (; !interrupted;) {          for (;;) {
                 int count;                  int count;
   
                 id = expected_id = conn->msg_id++;                  id = expected_id = conn->msg_id++;
Line 410 
Line 407 
         do_close(conn, handle, handle_len);          do_close(conn, handle, handle_len);
         xfree(handle);          xfree(handle);
   
         /* Don't return partial matches on interrupt */  
         if (interrupted && dir != NULL && *dir != NULL) {  
                 free_sftp_dirents(*dir);  
                 *dir = xmalloc(sizeof(**dir));  
                 **dir = NULL;  
         }  
   
         return(0);          return(0);
 }  }
   
Line 822 
Line 812 
                 char *data;                  char *data;
                 u_int len;                  u_int len;
   
                 /*  
                  * Simulate EOF on interrupt: stop sending new requests and  
                  * allow outstanding requests to drain gracefully  
                  */  
                 if (interrupted) {  
                         if (num_req == 0) /* If we haven't started yet... */  
                                 break;  
                         max_req = 0;  
                 }  
   
                 /* Send some more requests */                  /* Send some more requests */
                 while (num_req < max_req) {                  while (num_req < max_req) {
                         debug3("Request range %llu -> %llu (%d/%d)",                          debug3("Request range %llu -> %llu (%d/%d)",
Line 919 
Line 899 
                                             (unsigned long long)offset,                                              (unsigned long long)offset,
                                             num_req);                                              num_req);
                                         max_req = 1;                                          max_req = 1;
                                 } else if (max_req <= conn->num_requests) {                                  }
                                   else if (max_req < conn->num_requests + 1) {
                                         ++max_req;                                          ++max_req;
                                 }                                  }
                         }                          }
Line 990 
Line 971 
                 TAILQ_ENTRY(outstanding_ack) tq;                  TAILQ_ENTRY(outstanding_ack) tq;
         };          };
         TAILQ_HEAD(ackhead, outstanding_ack) acks;          TAILQ_HEAD(ackhead, outstanding_ack) acks;
         struct outstanding_ack *ack = NULL;          struct outstanding_ack *ack;
   
         TAILQ_INIT(&acks);          TAILQ_INIT(&acks);
   
Line 1051 
Line 1032 
                 int len;                  int len;
   
                 /*                  /*
                  * Can't use atomicio here because it returns 0 on EOF,                   * Can't use atomicio here because it returns 0 on EOF, thus losing
                  * thus losing the last block of the file.                   * the last block of the file
                  * Simulate an EOF on interrupt, allowing ACKs from the  
                  * server to drain.  
                  */                   */
                 if (interrupted)                  do
                         len = 0;  
                 else do  
                         len = read(local_fd, data, conn->transfer_buflen);                          len = read(local_fd, data, conn->transfer_buflen);
                 while ((len == -1) && (errno == EINTR || errno == EAGAIN));                  while ((len == -1) && (errno == EINTR || errno == EAGAIN));
   

Legend:
Removed from v.1.47.2.2  
changed lines
  Added in v.1.48