X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/4f5b0756df0dfc925b9576db47ecce949c378e18..a8ed49583304181a0516ce98014ae7389ec4c160:/receiver.c diff --git a/receiver.c b/receiver.c index 2f4bc7aa..92a2cf31 100644 --- a/receiver.c +++ b/receiver.c @@ -21,6 +21,7 @@ #include "rsync.h" extern int verbose; +extern int what_has_changed; extern int delete_after; extern int csum_length; extern struct stats stats; @@ -257,6 +258,36 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, } +static void read_gen_name(int fd, char *dirname, char *buf) +{ + int dlen; + int len = read_byte(fd); + + if (len & 0x80) { +#if MAXPATHLEN > 32767 + uchar lenbuf[2]; + read_buf(fd, (char *)lenbuf, 2); + len = (len & ~0x80) * 0x10000 + lenbuf[0] * 0x100 + lenbuf[1]; +#else + len = (len & ~0x80) * 0x100 + read_byte(fd); +#endif + } + + if (dirname) { + dlen = strlcpy(buf, dirname, MAXPATHLEN); + buf[dlen++] = '/'; + } else + dlen = 0; + + if (dlen + len >= MAXPATHLEN) { + rprintf(FERROR, "bogus data on generator name pipe\n"); + exit_cleanup(RERR_PROTOCOL); + } + + read_sbuf(fd, buf + dlen, len); +} + + static void discard_receive_data(int f_in, OFF_T length) { receive_data(f_in, NULL, -1, 0, NULL, -1, length); @@ -357,8 +388,8 @@ int recv_files(int f_in, struct file_list *flist, char *local_name, if (verbose > 2) rprintf(FINFO, "recv_files(%s)\n", safe_fname(fname)); - if (dry_run) { - if (!am_server && verbose) /* log the transfer */ + if (dry_run) { /* log the transfer */ + if (!am_server && verbose && !what_has_changed) rprintf(FINFO, "%s\n", safe_fname(fname)); continue; } @@ -396,6 +427,10 @@ int recv_files(int f_in, struct file_list *flist, char *local_name, case FNAMECMP_BACKUP: fnamecmp = get_backup_name(fname); break; + case FNAMECMP_FUZZY: + read_gen_name(f_in_name, file->dirname, fnamecmpbuf); + fnamecmp = fnamecmpbuf; + break; default: if (j >= basis_dir_cnt) { rprintf(FERROR, @@ -497,7 +532,8 @@ int recv_files(int f_in, struct file_list *flist, char *local_name, cleanup_set(fnametmp, partialptr, file, fd1, fd2); } - if (!am_server && verbose) /* log the transfer */ + /* log the transfer */ + if (!am_server && verbose && !what_has_changed) rprintf(FINFO, "%s\n", safe_fname(fname)); /* recv file data */