[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.4 and 1.5

version 1.4, 2001/02/06 23:30:28 version 1.5, 2001/02/07 10:55:12
Line 556 
Line 556 
         char *handle;          char *handle;
         Buffer msg;          Buffer msg;
         Attrib junk, *a;          Attrib junk, *a;
           int status;
   
         a = do_stat(fd_in, fd_out, remote_path);          a = do_stat(fd_in, fd_out, remote_path);
         if (a == NULL)          if (a == NULL)
Line 635 
Line 636 
                 if (id != expected_id)                  if (id != expected_id)
                         fatal("ID mismatch (%d != %d)", id, expected_id);                          fatal("ID mismatch (%d != %d)", id, expected_id);
                 if (type == SSH2_FXP_STATUS) {                  if (type == SSH2_FXP_STATUS) {
                         int status = buffer_get_int(&msg);                          status = buffer_get_int(&msg);
   
                         if (status == SSH2_FX_EOF)                          if (status == SSH2_FX_EOF)
                                 break;                                  break;
Line 644 
Line 645 
                                     "file \"%s\" : %s", remote_path,                                      "file \"%s\" : %s", remote_path,
                                      fx2txt(status));                                       fx2txt(status));
                                 do_close(fd_in, fd_out, handle, handle_len);                                  do_close(fd_in, fd_out, handle, handle_len);
                                 xfree(handle);                                  goto done;
                                 close(local_fd);  
                                 buffer_free(&msg);  
                                 return(status);  
                         }                          }
                 } else if (type != SSH2_FXP_DATA) {                  } else if (type != SSH2_FXP_DATA) {
                         fatal("Expected SSH2_FXP_DATA(%d) packet, got %d",                          fatal("Expected SSH2_FXP_DATA(%d) packet, got %d",
Line 665 
Line 663 
                         error("Couldn't write to \"%s\": %s", local_path,                          error("Couldn't write to \"%s\": %s", local_path,
                             strerror(errno));                              strerror(errno));
                         do_close(fd_in, fd_out, handle, handle_len);                          do_close(fd_in, fd_out, handle, handle_len);
                         xfree(handle);                          status = -1;
                         close(local_fd);  
                         xfree(data);                          xfree(data);
                         buffer_free(&msg);                          goto done;
                         return(-1);  
                 }                  }
   
                 offset += len;                  offset += len;
                 xfree(data);                  xfree(data);
         }          }
         xfree(handle);          status = do_close(fd_in, fd_out, handle, handle_len);
         buffer_free(&msg);  
         close(local_fd);  
   
         return(do_close(fd_in, fd_out, handle, handle_len));  done:
           close(local_fd);
           buffer_free(&msg);
           xfree(handle);
           return status;
 }  }
   
 int  int
Line 693 
Line 691 
         Buffer msg;          Buffer msg;
         struct stat sb;          struct stat sb;
         Attrib a;          Attrib a;
           int status;
   
         if ((local_fd = open(local_path, O_RDONLY, 0)) == -1) {          if ((local_fd = open(local_path, O_RDONLY, 0)) == -1) {
                 error("Couldn't open local file \"%s\" for reading: %s",                  error("Couldn't open local file \"%s\" for reading: %s",
Line 743 
Line 742 
         for(;;) {          for(;;) {
                 int len;                  int len;
                 char data[COPY_SIZE];                  char data[COPY_SIZE];
                 u_int status;  
   
                 /*                  /*
                  * Can't use atomicio here because it returns 0 on EOF, thus losing                   * Can't use atomicio here because it returns 0 on EOF, thus losing
Line 774 
Line 772 
                         error("Couldn't write to remote file \"%s\": %s",                          error("Couldn't write to remote file \"%s\": %s",
                             remote_path, fx2txt(status));                              remote_path, fx2txt(status));
                         do_close(fd_in, fd_out, handle, handle_len);                          do_close(fd_in, fd_out, handle, handle_len);
                         xfree(handle);  
                         close(local_fd);                          close(local_fd);
                         return(-1);                          goto done;
                 }                  }
                 debug3("In write loop, got %d offset %llu", len,                  debug3("In write loop, got %d offset %llu", len,
                     (unsigned long long)offset);                      (unsigned long long)offset);
   
                 offset += len;                  offset += len;
         }          }
         xfree(handle);  
         buffer_free(&msg);  
   
         if (close(local_fd) == -1) {          if (close(local_fd) == -1) {
                 error("Couldn't close local file \"%s\": %s", local_path,                  error("Couldn't close local file \"%s\": %s", local_path,
                     strerror(errno));                      strerror(errno));
                 do_close(fd_in, fd_out, handle, handle_len);                  do_close(fd_in, fd_out, handle, handle_len);
                 return(-1);                  status = -1;
                   goto done;
         }          }
   
         return(do_close(fd_in, fd_out, handle, handle_len));          status = do_close(fd_in, fd_out, handle, handle_len);
   
   done:
           xfree(handle);
           buffer_free(&msg);
           return status;
 }  }
   
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5