1 --- backup.c 23 Feb 2004 07:03:03 -0000 1.27
2 +++ backup.c 6 Mar 2004 07:25:05 -0000
3 @@ -130,8 +130,8 @@ failure:
4 /* robustly move a file, creating new directory structures if necessary */
5 static int robust_move(char *src, char *dst)
7 - if (robust_rename(src, dst, 0755) != 0 && (errno != ENOENT
8 - || make_bak_dir(dst) < 0 || robust_rename(src, dst, 0755) != 0))
9 + if (robust_rename(src, dst, 0755) < 0 && (errno != ENOENT
10 + || make_bak_dir(dst) < 0 || robust_rename(src, dst, 0755) < 0))
14 --- rsync.c 25 Feb 2004 21:20:59 -0000 1.133
15 +++ rsync.c 6 Mar 2004 07:25:05 -0000
16 @@ -235,15 +235,19 @@ void finish_transfer(char *fname, char *
17 if (make_backups && !make_backup(fname))
20 + /* Change permissions before putting the file into place. */
21 + set_perms(fnametmp, file, NULL, 0);
23 /* move tmp file over real file */
24 ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
27 rprintf(FERROR, "%s %s -> \"%s\": %s\n",
28 ret == -2 ? "copy" : "rename",
29 full_fname(fnametmp), fname, strerror(errno));
32 - set_perms(fname,file,NULL,0);
33 + } else if (ret == 1) {
34 + /* The file got copied, so set the permissions again. */
35 + set_perms(fname, file, NULL, 0);
39 --- t_stub.c 11 Sep 2003 04:48:13 -0000 1.4
40 +++ t_stub.c 6 Mar 2004 07:25:05 -0000
42 * functions, so that module test harnesses can run standalone.
46 int modify_window = 0;
48 struct exclude_struct **server_exclude_list;
49 --- util.c 17 Feb 2004 23:13:10 -0000 1.132
50 +++ util.c 6 Mar 2004 07:25:06 -0000
57 int sanitize_paths = 0;
59 @@ -262,6 +263,8 @@ int copy_file(char *source, char *dest,
63 + if (!am_root && !(mode & S_IWRITE))
65 ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
67 rprintf(FERROR,"open %s: %s\n",
68 @@ -353,8 +356,8 @@ int robust_unlink(char *fname)
72 -/* Returns 0 on success, -1 on most errors, and -2 if we got an error
73 - * trying to copy the file across file systems. */
74 +/* Returns 0 on successful rename, 1 if we successfully copied the file
75 + * across filesystems, -2 if copy_file() failed, and -1 on other errors. */
76 int robust_rename(char *from, char *to, int mode)
79 @@ -371,10 +374,12 @@ int robust_rename(char *from, char *to,
83 + if (!am_root && !(mode & S_IREAD))
84 + do_chmod(from, (mode & CHMOD_BITS) | S_IREAD);
85 if (copy_file(from, to, mode) != 0)