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

Diff for /src/usr.bin/ssh/scp.c between version 1.249 and 1.250

version 1.249, 2022/10/24 21:51:55 version 1.250, 2022/12/16 03:40:03
Line 96 
Line 96 
 #include <time.h>  #include <time.h>
 #include <unistd.h>  #include <unistd.h>
 #include <limits.h>  #include <limits.h>
   #include <util.h>
 #include <vis.h>  #include <vis.h>
   
 #include "xmalloc.h"  #include "xmalloc.h"
Line 150 
Line 151 
 pid_t do_cmd_pid = -1;  pid_t do_cmd_pid = -1;
 pid_t do_cmd_pid2 = -1;  pid_t do_cmd_pid2 = -1;
   
   /* SFTP copy parameters */
   size_t sftp_copy_buflen;
   size_t sftp_nrequests;
   
 /* Needed for sftp */  /* Needed for sftp */
 volatile sig_atomic_t interrupted = 0;  volatile sig_atomic_t interrupted = 0;
   
Line 418 
Line 423 
 int  int
 main(int argc, char **argv)  main(int argc, char **argv)
 {  {
         int ch, fflag, tflag, status, n;          int ch, fflag, tflag, status, r, n;
         char **newargv, *argv0;          char **newargv, *argv0;
         const char *errstr;          const char *errstr;
         extern char *optarg;          extern char *optarg;
         extern int optind;          extern int optind;
         enum scp_mode_e mode = MODE_SFTP;          enum scp_mode_e mode = MODE_SFTP;
         char *sftp_direct = NULL;          char *sftp_direct = NULL;
           long long llv;
   
         /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */          /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
         sanitise_stdfd();          sanitise_stdfd();
Line 452 
Line 458 
   
         fflag = Tflag = tflag = 0;          fflag = Tflag = tflag = 0;
         while ((ch = getopt(argc, argv,          while ((ch = getopt(argc, argv,
             "12346ABCTdfOpqRrstvD:F:J:M:P:S:c:i:l:o:")) != -1) {              "12346ABCTdfOpqRrstvD:F:J:M:P:S:c:i:l:o:X:")) != -1) {
                 switch (ch) {                  switch (ch) {
                 /* User-visible flags. */                  /* User-visible flags. */
                 case '1':                  case '1':
Line 533 
Line 539 
                         addargs(&remote_remote_args, "-q");                          addargs(&remote_remote_args, "-q");
                         showprogress = 0;                          showprogress = 0;
                         break;                          break;
                   case 'X':
                           /* Please keep in sync with sftp.c -X */
                           if (strncmp(optarg, "buffer=", 7) == 0) {
                                   r = scan_scaled(optarg + 7, &llv);
                                   if (r == 0 && (llv <= 0 || llv > 256 * 1024)) {
                                           r = -1;
                                           errno = EINVAL;
                                   }
                                   if (r == -1) {
                                           fatal("Invalid buffer size \"%s\": %s",
                                                optarg + 7, strerror(errno));
                                   }
                                   sftp_copy_buflen = (size_t)llv;
                           } else if (strncmp(optarg, "nrequests=", 10) == 0) {
                                   llv = strtonum(optarg + 10, 1, 256 * 1024,
                                       &errstr);
                                   if (errstr != NULL) {
                                           fatal("Invalid number of requests "
                                               "\"%s\": %s", optarg + 10, errstr);
                                   }
                                   sftp_nrequests = (size_t)llv;
                           } else {
                                   fatal("Invalid -X option");
                           }
                           break;
   
                 /* Server options. */                  /* Server options. */
                 case 'd':                  case 'd':
Line 941 
Line 972 
                     reminp, remoutp, pidp) < 0)                      reminp, remoutp, pidp) < 0)
                         return NULL;                          return NULL;
         }          }
         return do_init(*reminp, *remoutp, 32768, 64, limit_kbps);          return do_init(*reminp, *remoutp,
               sftp_copy_buflen, sftp_nrequests, limit_kbps);
 }  }
   
 void  void

Legend:
Removed from v.1.249  
changed lines
  Added in v.1.250