X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/1e1ca25343206df0ad8dccaefdae0506c7817532..01d29d7b02ba84510e288439872947365c07beff:/generator.c diff --git a/generator.c b/generator.c index 643b91b7..3607f2e4 100644 --- a/generator.c +++ b/generator.c @@ -98,6 +98,7 @@ int non_perishable_cnt = 0; static int deletion_count = 0; /* used to implement --max-delete */ static FILE *delete_delay_fp = NULL; +static BOOL solo_file = 0; /* For calling delete_item() and delete_dir_contents(). */ #define DEL_RECURSE (1<<1) /* recurse */ @@ -402,7 +403,7 @@ static void delete_in_dir(struct file_list *flist, char *fbuf, if (flist_find(flist, fp) < 0) { f_name(fp, delbuf); if (delete_delay_fp) - fprintf(delete_delay_fp, "%o %s%c", (short)fp->mode, delbuf, '\0'); + fprintf(delete_delay_fp, "%o %s%c", fp->mode, delbuf, '\0'); else delete_item(delbuf, fp->mode, NULL, DEL_RECURSE); } @@ -838,6 +839,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, char lnk[MAXPATHLEN]; int best_match = -1; int match_level = 0; + uint32 *devp; enum nonregtype type; int len, j = 0; @@ -895,7 +897,8 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, break; case TYPE_SPECIAL: case TYPE_DEVICE: - if (stp->st_rdev != MAKEDEV(F_DMAJOR(file), F_DMINOR(file))) + devp = F_RDEV_P(file); + if (stp->st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp))) continue; break; #ifdef SUPPORT_LINKS @@ -1171,7 +1174,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, const char *sl = F_SYMLINK(file); if (safe_symlinks && unsafe_symlink(sl, fname)) { if (verbose) { - if (the_file_list->count == 1) + if (solo_file) fname = f_name(file, NULL); rprintf(FINFO, "ignoring unsafe symlink %s -> \"%s\"\n", @@ -1252,7 +1255,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if ((am_root && preserve_devices && IS_DEVICE(file->mode)) || (preserve_specials && IS_SPECIAL(file->mode))) { - dev_t rdev = MAKEDEV(F_DMAJOR(file), F_DMINOR(file)); + uint32 *devp = F_RDEV_P(file); + dev_t rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)); if (statret == 0) { char *t; if (IS_DEVICE(file->mode)) { @@ -1304,8 +1308,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, return; #endif if (verbose > 2) { - rprintf(FINFO,"mknod(%s,0%o,0x%x)\n", - fname, (int)file->mode, (int)rdev); + rprintf(FINFO, "mknod(%s, 0%o, [%ld,%ld])\n", + fname, (int)file->mode, + (long)major(rdev), (long)minor(rdev)); } if (do_mknod(fname, file->mode, rdev) < 0) { rsyserr(FERROR, errno, "mknod %s failed", @@ -1329,7 +1334,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } if (!S_ISREG(file->mode)) { - if (the_file_list->count == 1) + if (solo_file) fname = f_name(file, NULL); rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname); return; @@ -1337,7 +1342,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (max_size && F_LENGTH(file) > max_size) { if (verbose > 1) { - if (the_file_list->count == 1) + if (solo_file) fname = f_name(file, NULL); rprintf(FINFO, "%s is over max-size\n", fname); } @@ -1345,7 +1350,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } if (min_size && F_LENGTH(file) < min_size) { if (verbose > 1) { - if (the_file_list->count == 1) + if (solo_file) fname = f_name(file, NULL); rprintf(FINFO, "%s is under min-size\n", fname); } @@ -1608,6 +1613,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name) maybe_ATTRS_REPORT = ATTRS_REPORT; code = FINFO; } + solo_file = local_name != NULL; if (verbose > 2) { rprintf(FINFO, "generator starting pid=%ld count=%d\n", @@ -1689,7 +1695,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name) make_backups = 0; /* avoid a duplicate backup for inplace processing */ if (verbose > 2) - rprintf(FINFO,"generate_files phase=%d\n",phase); + rprintf(FINFO, "generate_files phase=%d\n", phase); write_int(f_out, NDX_DONE); @@ -1711,7 +1717,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name) make_backups = save_make_backups; if (verbose > 2) - rprintf(FINFO,"generate_files phase=%d\n",phase); + rprintf(FINFO, "generate_files phase=%d\n", phase); write_int(f_out, NDX_DONE); /* Reduce round-trip lag-time for a useless delay-updates phase. */ @@ -1776,5 +1782,5 @@ void generate_files(int f_out, struct file_list *flist, char *local_name) } if (verbose > 2) - rprintf(FINFO,"generate_files finished\n"); + rprintf(FINFO, "generate_files finished\n"); }