aboutsummaryrefslogtreecommitdiffstats
path: root/generator.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-11-10 07:13:21 +0000
committerWayne Davison <wayned@samba.org>2006-11-10 07:13:21 +0000
commitb467495cd08d5365dab6920c5a0cf99b81cdcda3 (patch)
tree6f1bfe3a3f505c7bc37d3969635af366d41f4280 /generator.c
parent3b8ed84245622d9dc04f4d09d8fa7619bd5829b3 (diff)
downloadandroid_external_rsync-b467495cd08d5365dab6920c5a0cf99b81cdcda3.tar.gz
android_external_rsync-b467495cd08d5365dab6920c5a0cf99b81cdcda3.tar.bz2
android_external_rsync-b467495cd08d5365dab6920c5a0cf99b81cdcda3.zip
- Fixed a problem where the real stat struct for a newly-created
root-of-transfer directory could get overwritten by the check for basis dirs. - Fixed a potential problem where the stat struct for a new dir could get passed uninitialized to delete_in_dir().
Diffstat (limited to 'generator.c')
-rw-r--r--generator.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/generator.c b/generator.c
index 3834275f..facaeef0 100644
--- a/generator.c
+++ b/generator.c
@@ -976,7 +976,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
* file of that name and it is *not* a directory, then
* we need to delete it. If it doesn't exist, then
* (perhaps recursively) create it. */
- int sr;
if (statret == 0 && !S_ISDIR(st.st_mode)) {
if (delete_item(fname, st.st_mode, del_opts) < 0)
return;
@@ -986,26 +985,27 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
missing_below = file->dir.depth;
dry_run++;
}
- sr = statret;
+ real_ret = statret;
+ real_st = st;
if (new_root_dir) {
if (*fname == '.' && fname[1] == '\0')
- sr = -1;
+ statret = -1;
new_root_dir = 0;
}
- if (sr != 0 && basis_dir[0] != NULL) {
+ if (statret != 0 && basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
itemizing = 0;
code = FNONE;
} else if (j >= 0)
- sr = 1;
+ statret = 1;
}
if (itemizing && f_out != -1) {
- itemize(file, ndx, sr, &st,
- sr ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
+ itemize(file, ndx, statret, &st,
+ statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
- if (statret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
+ if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
if (!relative_paths || errno != ENOENT
|| create_directory_path(fname) < 0
|| (do_mkdir(fname, file->mode) < 0 && errno != EEXIST)) {
@@ -1022,9 +1022,11 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
return;
}
}
- if (set_file_attrs(fname, file, statret ? NULL : &st, 0)
+ if (set_file_attrs(fname, file, real_ret ? NULL : &real_st, 0)
&& verbose && code != FNONE && f_out != -1)
rprintf(code, "%s/\n", fname);
+ if (real_ret != 0 && one_file_system)
+ st.st_dev = filesystem_dev;
if (delete_during && f_out != -1 && !phase && dry_run < 2
&& (file->flags & FLAG_DEL_HERE))
delete_in_dir(the_file_list, fname, file, &st);