Added an extra phase to the end of the transfer to handle
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index fc670af..735173d 100644 (file)
--- a/util.c
+++ b/util.c
@@ -245,7 +245,8 @@ static int safe_read(int desc, char *ptr, size_t len)
 
 /** Copy a file.
  *
- * This is used in conjunction with the --temp-dir and --backup options */
+ * This is used in conjunction with the --temp-dir, --backup, and
+ * --copy-dest options. */
 int copy_file(char *source, char *dest, mode_t mode)
 {
        int ifd;
@@ -922,25 +923,21 @@ char *full_fname(const char *fn)
                p1 = p2 = "";
        else {
                p1 = curr_dir;
-               p2 = "/";
+               for (p2 = p1; *p2 == '/'; p2++) {}
+               if (*p2)
+                       p2 = "/";
        }
        if (module_id >= 0) {
                m1 = " (in ";
                m2 = lp_name(module_id);
                m3 = ")";
-               if (*p1) {
+               if (p1 == curr_dir) {
                        if (!lp_use_chroot(module_id)) {
                                char *p = lp_path(module_id);
                                if (*p != '/' || p[1])
                                        p1 += strlen(p);
                        }
-                       if (!*p1)
-                               p2++;
-                       else
-                               p1++;
                }
-               else
-                       fn++;
        } else
                m1 = m2 = m3 = "";