struct file_struct *file, int ndx,
int f_out, int f_out_name)
{
+ static int missing_below = -1;
int fd = -1, f_copy = -1;
STRUCT_STAT st, partial_st;
struct file_struct *back_file = NULL;
if (list_only)
return;
- if (verbose > 2)
- rprintf(FINFO, "recv_generator(%s,%d)\n", safe_fname(fname), ndx);
+ if (verbose > 2) {
+ rprintf(FINFO, "recv_generator(%s,%d)\n",
+ safe_fname(fname), ndx);
+ }
if (server_filter_list.head
&& check_filter(&server_filter_list, fname,
return;
}
+ if (dry_run && missing_below >= 0 && file->dir.depth <= missing_below) {
+ dry_run--;
+ missing_below = -1;
+ }
if (dry_run > 1) {
statret = -1;
stat_errno = ENOENT;
delete_file(fname, DEL_TERSE);
statret = -1;
}
+ if (dry_run && statret != 0 && missing_below < 0) {
+ missing_below = file->dir.depth;
+ dry_run++;
+ }
if (statret != 0 && do_mkdir(fname,file->mode) != 0 && errno != EEXIST) {
if (!relative_paths || errno != ENOENT
|| create_directory_path(fname, orig_umask) < 0
&& verbose && f_out != -1)
rprintf(FINFO, "%s/\n", safe_fname(fname));
if (delete_during && f_out != -1 && csum_length != SUM_LENGTH
- && (file->flags & FLAG_DEL_START)) {
- delete_in_dir(flist, fname, strlen(fname),
- file->dir.depth);
- }
+ && (file->flags & FLAG_DEL_HERE))
+ delete_in_dir(flist, fname, file);
return;
} else if (max_size && file->length > max_size) {
- if (verbose > 1)
- rprintf(FINFO, "%s is over max-size\n", fname);
+ if (verbose > 1) {
+ rprintf(FINFO, "%s is over max-size\n",
+ safe_fname(fname));
+ }
return;
}
#if SUPPORT_LINKS
if (safe_symlinks && unsafe_symlink(file->u.link, fname)) {
if (verbose) {
- rprintf(FINFO, "ignoring unsafe symlink %s -> \"%s\"\n",
- full_fname(fname), file->u.link);
+ rprintf(FINFO,
+ "ignoring unsafe symlink %s -> \"%s\"\n",
+ full_fname(fname),
+ safe_fname(file->u.link));
}
return;
}
if (verbose) {
rsyserr(FINFO, errno,
"link %s => %s",
- fnamecmpbuf,
+ full_fname(fnamecmpbuf),
safe_fname(fname));
}
fnamecmp = fnamecmpbuf;
statret = 0;
}
- if (dry_run || whole_file > 0) {
+ if (dry_run || read_batch)
+ goto notify_others;
+ if (whole_file > 0) {
statret = -1;
goto notify_others;
}
- if (read_batch)
- goto notify_others;
/* open the file */
fd = do_open(fnamecmp, O_RDONLY, 0);
set_perms(backupptr, back_file, NULL, 0);
if (verbose > 1) {
rprintf(FINFO, "backed up %s to %s\n",
- fname, backupptr);
+ safe_fname(fname), safe_fname(backupptr));
}
free(back_file);
}
flist, file, i, f_out, f_out_name);
}
if (delete_during)
- delete_in_dir(NULL, NULL, 0, 0);
+ delete_in_dir(NULL, NULL, NULL);
phase++;
csum_length = SUM_LENGTH;