From bcfac066f2314bdf28b6dd690adf0a044db05fcc Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 9 Aug 2004 20:58:50 +0000 Subject: [PATCH] Applied. --- early-chmod.diff | 77 ------------------------------------------------ 1 file changed, 77 deletions(-) delete mode 100644 early-chmod.diff diff --git a/early-chmod.diff b/early-chmod.diff deleted file mode 100644 index 095d414..0000000 --- a/early-chmod.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- orig/rsync.c 2004-07-26 16:06:53 -+++ rsync.c 2004-07-26 06:27:27 -@@ -246,6 +246,9 @@ void finish_transfer(char *fname, char * - goto do_set_perms; - } - -+ /* Change permissions before putting the file into place. */ -+ set_perms(fnametmp, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME); -+ - /* move tmp file over real file */ - if (verbose > 2) - rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname); -@@ -257,6 +260,10 @@ void finish_transfer(char *fname, char * - do_unlink(fnametmp); - return; - } -+ if (ret == 0) { -+ /* The file was moved into place (not copied), so it's done. */ -+ return; -+ } - do_set_perms: - set_perms(fname, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME); - } ---- orig/t_stub.c 2004-07-29 16:08:04 -+++ t_stub.c 2004-07-03 20:17:55 -@@ -26,6 +26,7 @@ - * functions, so that module test harnesses can run standalone. - **/ - -+int am_root = 0; - int modify_window = 0; - int module_id = -1; - char *partial_dir; ---- orig/util.c 2004-07-29 16:08:04 -+++ util.c 2004-07-03 20:17:55 -@@ -29,6 +29,7 @@ - - extern int verbose; - extern int dry_run; -+extern int am_root; - extern int module_id; - extern int modify_window; - extern char *partial_dir; -@@ -264,6 +265,8 @@ int copy_file(char *source, char *dest, - return -1; - } - -+ if (!am_root && !(mode & S_IWUSR)) -+ mode |= S_IWUSR; - ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode); - if (ofd == -1) { - rsyserr(FERROR, errno, "open %s", full_fname(dest)); -@@ -362,8 +365,8 @@ int robust_unlink(char *fname) - #endif - } - --/* Returns 0 on success, -1 on most errors, and -2 if we got an error -- * trying to copy the file across file systems. */ -+/* Returns 0 on successful rename, 1 if we successfully copied the file -+ * across filesystems, -2 if copy_file() failed, and -1 on other errors. */ - int robust_rename(char *from, char *to, int mode) - { - int tries = 4; -@@ -380,10 +383,12 @@ int robust_rename(char *from, char *to, - break; - #endif - case EXDEV: -+ if (!am_root && !(mode & S_IRUSR)) -+ do_chmod(from, (mode & CHMOD_BITS) | S_IRUSR); - if (copy_file(from, to, mode) != 0) - return -2; - do_unlink(from); -- return 0; -+ return 1; - default: - return -1; - } -- 2.34.1