1 --- orig/rsync.c 2004-07-02 18:06:32
2 +++ rsync.c 2004-07-03 20:17:55
3 @@ -239,6 +239,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 */
12 rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
13 @@ -248,7 +251,8 @@ void finish_transfer(char *fname, char *
14 ret == -2 ? "copy" : "rename",
15 full_fname(fnametmp), fname);
18 + } else if (ret == 1) {
19 + /* The file got copied, so set the permissions again. */
20 set_perms(fname, file, NULL,
21 ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
23 --- orig/t_stub.c 2004-05-15 20:10:13
24 +++ t_stub.c 2004-07-03 20:17:55
26 * functions, so that module test harnesses can run standalone.
30 int modify_window = 0;
32 struct exclude_list_struct server_exclude_list;
33 --- orig/util.c 2004-06-09 21:54:47
34 +++ util.c 2004-07-03 20:17:55
41 extern int modify_window;
42 extern struct exclude_list_struct server_exclude_list;
43 @@ -263,6 +264,8 @@ int copy_file(char *source, char *dest,
47 + if (!am_root && !(mode & S_IWUSR))
49 ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
51 rsyserr(FERROR, errno, "open %s", full_fname(dest));
52 @@ -361,8 +364,8 @@ int robust_unlink(char *fname)
56 -/* Returns 0 on success, -1 on most errors, and -2 if we got an error
57 - * trying to copy the file across file systems. */
58 +/* Returns 0 on successful rename, 1 if we successfully copied the file
59 + * across filesystems, -2 if copy_file() failed, and -1 on other errors. */
60 int robust_rename(char *from, char *to, int mode)
63 @@ -379,10 +382,12 @@ int robust_rename(char *from, char *to,
67 + if (!am_root && !(mode & S_IRUSR))
68 + do_chmod(from, (mode & CHMOD_BITS) | S_IRUSR);
69 if (copy_file(from, to, mode) != 0)