1 --- rsync.c 23 Mar 2004 16:16:15 -0000 1.135
2 +++ rsync.c 15 Apr 2004 19:14:12 -0000
3 @@ -235,6 +235,9 @@ void finish_transfer(char *fname, char *
4 if (make_backups && !make_backup(fname))
7 + /* Change permissions before putting the file into place. */
8 + set_perms(fnametmp, file, NULL, 0);
10 /* move tmp file over real file */
11 ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
13 @@ -242,8 +245,9 @@ void finish_transfer(char *fname, char *
14 ret == -2 ? "copy" : "rename",
15 full_fname(fnametmp), fname, strerror(errno));
18 - set_perms(fname,file,NULL,0);
19 + } else if (ret == 1) {
20 + /* The file got copied, so set the permissions again. */
21 + set_perms(fname, file, NULL, 0);
25 --- t_stub.c 14 Apr 2004 23:33:34 -0000 1.6
26 +++ t_stub.c 15 Apr 2004 19:14:12 -0000
28 * functions, so that module test harnesses can run standalone.
32 int modify_window = 0;
34 struct exclude_list_struct server_exclude_list;
35 --- util.c 14 Apr 2004 23:33:34 -0000 1.135
36 +++ util.c 15 Apr 2004 19:14:13 -0000
42 extern struct exclude_list_struct server_exclude_list;
44 int sanitize_paths = 0;
45 @@ -263,6 +264,8 @@ int copy_file(char *source, char *dest,
49 + if (!am_root && !(mode & S_IWUSR))
51 ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
53 rprintf(FERROR,"open %s: %s\n",
54 @@ -354,8 +357,8 @@ int robust_unlink(char *fname)
58 -/* Returns 0 on success, -1 on most errors, and -2 if we got an error
59 - * trying to copy the file across file systems. */
60 +/* Returns 0 on successful rename, 1 if we successfully copied the file
61 + * across filesystems, -2 if copy_file() failed, and -1 on other errors. */
62 int robust_rename(char *from, char *to, int mode)
65 @@ -372,10 +375,12 @@ int robust_rename(char *from, char *to,
69 + if (!am_root && !(mode & S_IRUSR))
70 + do_chmod(from, (mode & CHMOD_BITS) | S_IRUSR);
71 if (copy_file(from, to, mode) != 0)