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.]

--- orig/syscall.c	2005-07-28 18:48:38
+++ syscall.c	2004-04-22 23:48:45
@@ -62,9 +62,14 @@ int do_symlink(char *fname1, char *fname
 #ifdef HAVE_LINK
 int do_link(char *fname1, 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
 
