* call will append names onto the end, but the old dir value will be restored
* on exit). */
static void delete_in_dir(struct file_list *flist, char *fbuf,
- struct file_struct *file)
+ struct file_struct *file, STRUCT_STAT *stp)
{
static int min_depth = MAXPATHLEN, cur_depth = -1;
static void *filt_array[MAXPATHLEN/2+1];
static int already_warned = 0;
struct file_list *dirlist;
char delbuf[MAXPATHLEN];
- STRUCT_STAT st;
int dlen, i;
if (!flist) {
dlen = strlen(fbuf);
filt_array[cur_depth] = push_local_filters(fbuf, dlen);
- if (link_stat(fbuf, &st, keep_dirlinks) < 0 || !S_ISDIR(st.st_mode))
- return;
-
if (one_file_system) {
if (file->flags & FLAG_TOP_DIR)
- filesystem_dev = st.st_dev;
- else if (filesystem_dev != st.st_dev)
+ filesystem_dev = stp->st_dev;
+ else if (filesystem_dev != stp->st_dev)
return;
}
static void do_delete_pass(struct file_list *flist)
{
char fbuf[MAXPATHLEN];
+ STRUCT_STAT st;
int j;
if (dry_run > 1 /* destination doesn't exist yet */
if (verbose > 1 && file->flags & FLAG_TOP_DIR)
rprintf(FINFO, "deleting in %s\n", fbuf);
- delete_in_dir(flist, fbuf, file);
+ if (link_stat(fbuf, &st, keep_dirlinks) < 0
+ || !S_ISDIR(st.st_mode))
+ continue;
+
+ delete_in_dir(flist, fbuf, file, &st);
}
- delete_in_dir(NULL, NULL, NULL);
+ delete_in_dir(NULL, NULL, NULL, NULL);
if (do_progress && !am_server)
rprintf(FINFO, " \r");
|| !unchanged_attrs(file, &st))
continue;
if (S_ISLNK(file->mode)) {
+#ifdef SUPPORT_LINKS
if ((len = readlink(fnamebuf, lnk, MAXPATHLEN-1)) <= 0)
continue;
lnk[len] = '\0';
if (strcmp(lnk, file->u.link) != 0)
+#endif
continue;
} else {
if (!IS_DEVICE(st.st_mode) || st.st_rdev != file->u.rdev)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
&& (file->flags & FLAG_DEL_HERE))
- delete_in_dir(the_file_list, fname, file);
+ delete_in_dir(the_file_list, fname, file, &st);
return;
}
}
recv_generator(NULL, NULL, 0, 0, 0, code, -1);
if (delete_during)
- delete_in_dir(NULL, NULL, NULL);
+ delete_in_dir(NULL, NULL, NULL, NULL);
phase++;
csum_length = SUM_LENGTH;