extern int keep_dirlinks;
extern int preserve_links;
extern int preserve_devices;
+extern int preserve_specials;
extern int preserve_hard_links;
extern int preserve_perms;
extern int preserve_uid;
extern long block_size; /* "long" because popt can't set an int32. */
extern int max_delete;
extern int force_delete;
+extern int one_file_system;
extern struct stats stats;
+extern dev_t filesystem_dev;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
* 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];
dlen = strlen(fbuf);
filt_array[cur_depth] = push_local_filters(fbuf, dlen);
- if (file->flags & FLAG_MOUNT_POINT)
- return;
+ if (one_file_system) {
+ if (file->flags & FLAG_TOP_DIR)
+ filesystem_dev = stp->st_dev;
+ else if (filesystem_dev != stp->st_dev)
+ return;
+ }
dirlist = get_dirlist(fbuf, dlen, 0);
* from the filesystem. */
for (i = dirlist->count; i--; ) {
struct file_struct *fp = dirlist->files[i];
- if (!fp->basename)
+ if (!fp->basename || fp->flags & FLAG_MOUNT_POINT)
continue;
- if (fp->flags & FLAG_MOUNT_POINT) {
- int j = flist_find(flist, fp);
- if (j >= 0)
- flist->files[j]->flags |= FLAG_MOUNT_POINT;
- continue;
- }
if (flist_find(flist, fp) < 0) {
int mode = fp->mode;
f_name(fp, delbuf);
|| !S_ISDIR(st.st_mode))
continue;
- delete_in_dir(flist, fbuf, file);
+ 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");
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;
}
return;
}
- if (am_root && preserve_devices && IS_DEVICE(file->mode)) {
+ if ((am_root && preserve_devices && IS_DEVICE(file->mode))
+ || (preserve_specials && IS_SPECIAL(file->mode))) {
if (statret != 0
&& (basis_dir[0] != NULL && can_link_devices)) {
if (try_dests_non(file, fname, ndx, itemizing,
&& hard_link_check(file, ndx, fname, -1, &st,
itemizing, code, HL_SKIP))
return;
- if (!IS_DEVICE(st.st_mode))
+ if ((IS_DEVICE(file->mode) && !IS_DEVICE(st.st_mode))
+ || (IS_SPECIAL(file->mode) && !IS_SPECIAL(st.st_mode)))
statret = -1;
if (verbose > 2) {
rprintf(FINFO,"mknod(%s,0%o,0x%x)\n",
}
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;