File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / patches / soften-links.diff
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 2 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

Marco d'Itri wrote:

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?

To use this patch, run these commands for a successful build:

    patch -p1 <patches/soften-links.diff
    ./configure                           (optional if already run)
    make

based-on: e94bad1c156fc3910f24e2b3b71a81b0b0bdeb70
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
@@ -132,13 +132,18 @@ ssize_t do_readlink(const char *path, char *buf, size_t bufsiz)
 #if defined HAVE_LINK || defined HAVE_LINKAT
 int do_link(const char *old_path, const char *new_path)
 {
+	int st;
+
 	if (dry_run) return 0;
 	RETURN_ERROR_IF_RO_OR_LO;
 #ifdef HAVE_LINKAT
-	return linkat(AT_FDCWD, old_path, AT_FDCWD, new_path, 0);
+	st = linkat(AT_FDCWD, old_path, AT_FDCWD, new_path, 0);
 #else
-	return link(old_path, new_path);
+	st = link(old_path, new_path);
 #endif
+	if (/*soften_links &&*/ st != 0 && errno == EXDEV)
+		st = symlink(old_path, new_path);
+	return st;
 }
 #endif
 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>