wayned> On Tue, Feb 17, 2004 at 10:28:20AM -0500, Jason M. Felice wrote:
wayned> > All callers of robust_rename() call copy_file() if EXDEV is received.
wayned> > This patch moves the copy_file() call into robust_rename().
wayned> 
wayned> Seems like a good simplification.  I did a refinement pass on your
wayned> changes, and also added back a do_unlink() call that should not have
wayned> been dropped.  So, here's my version of the patch.

        I use rsync 2.6.1cvs.
        With --backup --backup-dir=... , rsync sometimes says some
errors like "No such file or directory".
        I made a little fixes.

Index: backup.c
===================================================================
RCS file: /cvsroot/rsync/backup.c,v
retrieving revision 1.26
diff -u -r1.26 backup.c
--- backup.c    17 Feb 2004 23:13:10 -0000      1.26
+++ backup.c    23 Feb 2004 05:05:07 -0000
@@ -130,8 +130,8 @@
 /* robustly move a file, creating new directory structures if necessary */
 static int robust_move(char *src, char *dst)
 {
-       if (robust_rename(src, dst, 0755) != 0 || errno != ENOENT
-           || make_bak_dir(dst) < 0 || robust_rename(src, dst, 0755) != 0)
+       if (robust_rename(src, dst, 0755) != 0 && (errno != ENOENT
+           || make_bak_dir(dst) < 0 || robust_rename(src, dst, 0755) != 0))
                return -1;
        return 0;
 }
@@ -224,7 +224,7 @@
 
        /* move to keep tree if a file */
        if (!kept) {
-               if (!robust_move(fname, backup_dir_buf)) {
+               if (robust_move(fname, backup_dir_buf) != 0) {
                        rprintf(FERROR, "keep_backup failed: %s -> \"%s\": %s\n",
                                full_fname(fname), backup_dir_buf, strerror(errno));
                }

-- 
Yes, I'm in panic.
Shinichi Maruyama ([EMAIL PROTECTED])
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to