[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.17 and 1.17.4.1

version 1.17, 2019/05/08 20:00:25 version 1.17.4.1, 2021/11/09 13:41:24
Line 17 
Line 17 
 #include <sys/stat.h>  #include <sys/stat.h>
   
 #include <assert.h>  #include <assert.h>
   #include <err.h>
 #include <stdint.h>  #include <stdint.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 25 
Line 26 
   
 #define RSYNC_PATH      "rsync"  #define RSYNC_PATH      "rsync"
   
   const char *
   alt_base_mode(int mode)
   {
           switch (mode) {
           case BASE_MODE_COMPARE:
                   return "--compare-dest";
           case BASE_MODE_COPY:
                   return "--copy-dest";
           case BASE_MODE_LINK:
                   return "--link-dest";
           default:
                   errx(1, "unknown base mode %d", mode);
           }
   }
   
 char **  char **
 fargs_cmdline(struct sess *sess, const struct fargs *f, size_t *skip)  fargs_cmdline(struct sess *sess, const struct fargs *f, size_t *skip)
 {  {
Line 51 
Line 67 
                 if (sess->opts->ssh_prog) {                  if (sess->opts->ssh_prog) {
                         ap = strdup(sess->opts->ssh_prog);                          ap = strdup(sess->opts->ssh_prog);
                         if (ap == NULL)                          if (ap == NULL)
                                 goto out;                                  err(ERR_NOMEM, NULL);
   
                         while ((arg = strsep(&ap, " \t")) != NULL) {                          while ((arg = strsep(&ap, " \t")) != NULL) {
                                 if (arg[0] == '\0') {                                  if (arg[0] == '\0') {
Line 115 
Line 131 
         if (!sess->opts->specials && sess->opts->devices)          if (!sess->opts->specials && sess->opts->devices)
                 /* --devices is sent as -D --no-specials */                  /* --devices is sent as -D --no-specials */
                 addargs(&args, "--no-specials");                  addargs(&args, "--no-specials");
           if (sess->opts->max_size >= 0)
                   addargs(&args, "--max-size=%lld", sess->opts->max_size);
           if (sess->opts->min_size >= 0)
                   addargs(&args, "--min-size=%lld", sess->opts->min_size);
   
           /* only add --compare-dest, etc if this is the sender */
           if (sess->opts->alt_base_mode != 0 &&
               f->mode == FARGS_SENDER) {
                   for (j = 0; j < MAX_BASEDIR; j++) {
                           if (sess->opts->basedir[j] == NULL)
                                   break;
                           addargs(&args, "%s=%s",
                               alt_base_mode(sess->opts->alt_base_mode),
                               sess->opts->basedir[j]);
                   }
           }
   
         /* Terminate with a full-stop for reasons unknown. */          /* Terminate with a full-stop for reasons unknown. */
   
         addargs(&args, ".");          addargs(&args, ".");
Line 127 
Line 159 
                 addargs(&args, "%s", f->sink);                  addargs(&args, "%s", f->sink);
   
         return args.list;          return args.list;
 out:  
         freeargs(&args);  
         ERR("calloc");  
         return NULL;  
 }  }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.17.4.1