Need to make sure that the destination file doesn't exist before we
authorWayne Davison <wayned@samba.org>
Mon, 27 Sep 2004 18:52:51 +0000 (18:52 +0000)
committerWayne Davison <wayned@samba.org>
Mon, 27 Sep 2004 18:52:51 +0000 (18:52 +0000)
try to link from a hashed file to the destination.

link-by-hash.diff

index 37a3450..49bcf6b 100644 (file)
@@ -323,6 +323,7 @@ the file's name.
 +      if (!first) {
 +              rprintf(FINFO, "link-by-hash (existing): \"%s\" -> %s\n",
 +                              linkname, full_fname(fname));
++              robust_unlink(fname);
 +              rc = do_link(linkname, fname);
 +              if (rc == -1) {
 +                      if (errno == EMLINK) {
@@ -335,7 +336,6 @@ the file's name.
 +                      } else {
 +                              rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"",
 +                                      linkname, full_fname(fname));
-+                              robust_unlink(fname);
 +                              rc = robust_rename(fnametmp,fname,0644);
 +                      }
 +              } else {