-
Notifications
You must be signed in to change notification settings - Fork 8
/
soften-links.diff
37 lines (32 loc) · 1.09 KB
/
soften-links.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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: 6c8ca91c731b7bf2b081694bda85b7dadc2b7aff
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
@@ -136,13 +136,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