X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/45c49b52a488882bbbd5366420389abbbeede7c9..b5c6a6aeeb7d526e023454ea681b7381945bced8:/backup.c diff --git a/backup.c b/backup.c index e34b7be9..11011cfd 100644 --- a/backup.c +++ b/backup.c @@ -30,6 +30,7 @@ extern char *backup_dir; extern int am_root; extern int preserve_devices; +extern int preserve_specials; extern int preserve_links; extern int preserve_hard_links; extern int orig_umask; @@ -180,14 +181,15 @@ static int keep_backup(char *fname) if (do_lstat(fname, &st) < 0) return 1; - if (!(file = make_file(fname, NULL, NO_FILTERS))) + if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) return 1; /* the file could have disappeared */ if (!(buf = get_backup_name(fname))) return 0; /* Check to see if this is a device file, or link */ - if (IS_DEVICE(file->mode) && am_root && preserve_devices) { + if ((am_root && preserve_devices && IS_DEVICE(file->mode)) + || (preserve_specials && IS_SPECIAL(file->mode))) { do_unlink(buf); if (do_mknod(buf, file->mode, file->u.rdev) < 0 && (errno != ENOENT || make_bak_dir(buf) < 0