| 1 | Marco d'Itri wrote: |
| 2 | |
| 3 | I run one of the debian mirrors, and I had to write this patch because |
| 4 | my archive is split between more than one disk. Would you accept a more |
| 5 | polished version of this patch for inclusion in rsync? |
| 6 | |
| 7 | To use this patch, run these commands for a successful build: |
| 8 | |
| 9 | patch -p1 <patches/soften-links.diff |
| 10 | ./configure (optional if already run) |
| 11 | make |
| 12 | |
| 13 | --- old/syscall.c |
| 14 | +++ new/syscall.c |
| 15 | @@ -59,9 +59,14 @@ int do_symlink(const char *fname1, const |
| 16 | #ifdef HAVE_LINK |
| 17 | int do_link(const char *fname1, const char *fname2) |
| 18 | { |
| 19 | + int st; |
| 20 | + |
| 21 | if (dry_run) return 0; |
| 22 | RETURN_ERROR_IF_RO_OR_LO; |
| 23 | - return link(fname1, fname2); |
| 24 | + st = link(fname1, fname2); |
| 25 | + if (/*soften_links &&*/ st != 0 && errno == EXDEV) |
| 26 | + st = symlink(fname1, fname2); |
| 27 | + return st; |
| 28 | } |
| 29 | #endif |
| 30 | |