summaryrefslogtreecommitdiff
path: root/hlink.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-02-11 05:03:04 +0000
committerWayne Davison <wayned@samba.org>2004-02-11 05:03:04 +0000
commit417c99f6373076931b66f9d5986cd6ededcbb197 (patch)
tree63b1b604a0794ed387aec0b1ed309ce35ca88a51 /hlink.c
parentde0e225076c97a15cabceb0de7ab9bc636a483f4 (diff)
downloadrsync-417c99f6373076931b66f9d5986cd6ededcbb197.tar.gz
rsync-417c99f6373076931b66f9d5986cd6ededcbb197.tar.bz2
rsync-417c99f6373076931b66f9d5986cd6ededcbb197.zip
If --backup was specified, the links we remove are backed up.
Diffstat (limited to 'hlink.c')
-rw-r--r--hlink.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hlink.c b/hlink.c
index f42df53d..110e6ede 100644
--- a/hlink.c
+++ b/hlink.c
@@ -22,6 +22,7 @@
extern int dry_run;
extern int verbose;
+extern int make_backups;
#if SUPPORT_HARD_LINKS
static int hlink_compare(struct file_struct **file1, struct file_struct **file2)
@@ -38,8 +39,8 @@ static int hlink_compare(struct file_struct **file1, struct file_struct **file2)
return file_compare(file1, file2);
}
-struct file_struct **hlink_list;
-int hlink_count;
+static struct file_struct **hlink_list;
+static int hlink_count;
#define LINKED(p1,p2) ((p1)->F_DEV == (p2)->F_DEV \
&& (p1)->F_INODE == (p2)->F_INODE)
@@ -190,7 +191,10 @@ void do_hard_links(void)
if (st2.st_dev == st1.st_dev
&& st2.st_ino == st1.st_ino)
continue;
- if (robust_unlink(hlink2)) {
+ if (make_backups) {
+ if (!make_backup(hlink2))
+ continue;
+ } else if (robust_unlink(hlink2)) {
if (verbose > 0) {
rprintf(FINFO,
"unlink %s failed: %s\n",