Date: Fri, 12 Apr 2002 13:44:22 +0200
From: Marco d'Itri <md@Linux.IT>
To: mbp@samba.org
Subject: rsync and debian mirrors

I run one of the debian mirrors, and I had to write this patch because
my archive is split between more than one disk. Would you accept a more
polished version of this patch for inclusion in rsync?

[Updated to latest CVS source by Wayne Davison.]

--- old/syscall.c
+++ new/syscall.c
@@ -62,9 +62,14 @@ int do_symlink(const char *fname1, const
 #ifdef HAVE_LINK
 int do_link(const char *fname1, const char *fname2)
 {
+	int st;
+
 	if (dry_run) return 0;
 	RETURN_ERROR_IF_RO_OR_LO;
-	return link(fname1, fname2);
+	st = link(fname1, fname2);
+	if (/*soften_links &&*/ st != 0 && errno == EXDEV)
+		st = symlink(fname1, fname2);
+	return st;
 }
 #endif
 
