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

Diff for /src/usr.bin/rsync/fargs.c between version 1.10 and 1.11

version 1.10, 2019/02/14 18:26:52 version 1.11, 2019/02/14 18:31:36
Line 30 
Line 30 
 {  {
         char            **args = NULL, **new;          char            **args = NULL, **new;
         size_t            i = 0, n = 1, j, argsz = 0;          size_t            i = 0, n = 1, j, argsz = 0;
         char             *rsync_path;          char             *rsync_path, *ap;
   
         assert(f != NULL);          assert(f != NULL);
         assert(f->sourcesz > 0);          assert(f->sourcesz > 0);
Line 54 
Line 54 
         if (f->host != NULL) {          if (f->host != NULL) {
                 assert(f->host != NULL);                  assert(f->host != NULL);
   
                 if (sess->opts->ssh_prog) {                  /*
                         char *ap = strdup(sess->opts->ssh_prog);                   * Splice arguments from -e "foo bar baz" into array
                    * elements required for execve(2).
                    * This doesn't do anything fancy: it splits along
                    * whitespace into the array.
                    */
   
                   if (sess->opts->ssh_prog) {
                           ap = strdup(sess->opts->ssh_prog);
                         if (ap == NULL)                          if (ap == NULL)
                                 goto out;                                  goto out;
   
                         while ((args[i] = strsep(&ap, " \t")) != NULL) {                          while ((args[i] = strsep(&ap, " \t")) != NULL) {
                                 if (args[i][0] == '\0') {                                  if (args[i][0] == '\0') {
                                         ap++;   /* skip seperators */                                          ap++;   /* skip seperators */
Line 66 
Line 73 
                                 }                                  }
   
                                 /* Grow command-area of array */                                  /* Grow command-area of array */
   
                                 if (i++ < n)                                  if (i++ < n)
                                         continue;                                          continue;
                                 n += 10;                                  n += 10;
                                 new = reallocarray(args, argsz + n, sizeof(char *));                                  new = reallocarray(args,
                                           argsz + n, sizeof(char *));
                                 if (new == NULL)                                  if (new == NULL)
                                         goto out;                                          goto out;
                                 args = new;                                  args = new;
Line 77 
Line 86 
                         }                          }
                 } else                  } else
                         args[i++] = "ssh";                          args[i++] = "ssh";
   
                 args[i++] = f->host;                  args[i++] = f->host;
                 args[i++] = rsync_path;                  args[i++] = rsync_path;
                 args[i++] = "--server";                  args[i++] = "--server";

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11