Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sender realigns chunks with generator during an --inplace copy
[rsync/rsync.git]
/
generator.c
diff --git
a/generator.c
b/generator.c
index
61a2305
..
8fd4a19
100644
(file)
--- a/
generator.c
+++ b/
generator.c
@@
-1282,9
+1282,18
@@
static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
goto cleanup;
}
+ fnamecmp = fname;
+
if (is_dir) {
if (is_dir) {
+ mode_t added_perms;
if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR)
goto cleanup;
if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR)
goto cleanup;
+ if (am_root < 0) {
+ /* For --fake-super, the dir must be useable by the copying
+ * user, just like it would be for root. */
+ added_perms = S_IRUSR|S_IWUSR|S_IXUSR;
+ } else
+ added_perms = 0;
if (is_dir < 0) {
/* In inc_recurse mode we want to make sure any missing
* directories get created while we're still processing
if (is_dir < 0) {
/* In inc_recurse mode we want to make sure any missing
* directories get created while we're still processing
@@
-1295,7
+1304,7
@@
static void recv_generator(char *fname, struct file_struct *file, int ndx,
&& (S_ISDIR(sx.st.st_mode)
|| delete_item(fname, sx.st.st_mode, del_opts | DEL_FOR_DIR) != 0))
goto cleanup; /* Any errors get reported later. */
&& (S_ISDIR(sx.st.st_mode)
|| delete_item(fname, sx.st.st_mode, del_opts | DEL_FOR_DIR) != 0))
goto cleanup; /* Any errors get reported later. */
- if (do_mkdir(fname,
file->mode
& 0700) == 0)
+ if (do_mkdir(fname,
(file->mode|added_perms)
& 0700) == 0)
file->flags |= FLAG_DIR_CREATED;
goto cleanup;
}
file->flags |= FLAG_DIR_CREATED;
goto cleanup;
}
@@
-1329,17
+1338,19
@@
static void recv_generator(char *fname, struct file_struct *file, int ndx,
itemizing = 0;
code = FNONE;
statret = 1;
itemizing = 0;
code = FNONE;
statret = 1;
- } else if (j >= 0)
+ } else if (j >= 0)
{
statret = 1;
statret = 1;
+ fnamecmp = fnamecmpbuf;
+ }
}
if (itemizing && f_out != -1) {
}
if (itemizing && f_out != -1) {
- itemize(fname, file, ndx, statret, &sx,
+ itemize(fname
cmp
, file, ndx, statret, &sx,
statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
- if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
+ if (real_ret != 0 && do_mkdir(fname,file->mode
|added_perms
) < 0 && errno != EEXIST) {
if (!relative_paths || errno != ENOENT
|| make_path(fname, MKP_DROP_NAME | MKP_SKIP_SLASH) < 0
if (!relative_paths || errno != ENOENT
|| make_path(fname, MKP_DROP_NAME | MKP_SKIP_SLASH) < 0
- || (do_mkdir(fname, file->mode) < 0 && errno != EEXIST)) {
+ || (do_mkdir(fname, file->mode
|added_perms
) < 0 && errno != EEXIST)) {
rsyserr(FERROR_XFER, errno,
"recv_generator: mkdir %s failed",
full_fname(fname));
rsyserr(FERROR_XFER, errno,
"recv_generator: mkdir %s failed",
full_fname(fname));
@@
-1590,7
+1601,6
@@
static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
goto cleanup;
}
- fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(sx.st.st_mode)) {