Patch from Marco d'Itri that sketches a --soften-links option.
[rsync/rsync-patches.git] / soften-links.diff
1 From md@Linux.IT Fri Apr 12 21:45:04 2002
2 Return-Path: <md@Linux.IT>
3 Delivered-To: mbp@samba.org
4 Received: from attila.bofh.it (attila.bofh.it [213.92.8.2])
5         by lists.samba.org (Postfix) with ESMTP id 1D3674500
6         for <mbp@samba.org>; Fri, 12 Apr 2002 04:45:04 -0700 (PDT)
7 Received: by attila.bofh.it (Postfix, from userid 10)
8         id 462BB5FA70; Fri, 12 Apr 2002 13:44:29 +0200 (CEST)
9 Received: by wonderland.linux.it (Postfix/Md, from userid 1001)
10         id D8B4E33B2D; Fri, 12 Apr 2002 13:44:22 +0200 (CEST)
11 Date: Fri, 12 Apr 2002 13:44:22 +0200
12 From: Marco d'Itri <md@Linux.IT>
13 To: mbp@samba.org
14 Subject: rsync and debian mirrors
15 Message-ID: <20020412114422.GA1664@wonderland.linux.it>
16 Mime-Version: 1.0
17 Content-Type: text/plain; charset=us-ascii
18 Content-Disposition: inline
19 User-Agent: Mutt/1.3.28i
20 Status: RO
21 X-Status: A
22 Content-Length: 658
23 Lines: 26
24
25 I run one of the debian mirrors, and I had to write this patch because
26 my archive is split between more than one disk. Would you accept a more
27 polished version of this patch for inclusion in rsync?
28
29 --- syscall.c.orig      Thu May 31 16:14:07 2001
30 +++ syscall.c   Thu May 31 16:40:46 2001
31 @@ -45,9 +45,14 @@
32  #if HAVE_LINK
33  int do_link(char *fname1, char *fname2)
34  {
35 +       int st;
36 +
37         if (dry_run) return 0;
38         CHECK_RO
39 -       return link(fname1, fname2);
40 +       st = link(fname1, fname2);
41 +       if (/*soften_links &&*/ st != 0 && errno == EXDEV)
42 +               st = symlink(fname1, fname2);
43 +       return st;
44  }
45  #endif
46
47
48 -- 
49 ciao,
50 Marco
51