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
fixed a race condition in the --delete handling code. The bug led to
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
e120f80
..
5cf3044
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-163,7
+163,7
@@
void send_file_entry(struct file_struct *file,int f,unsigned base_flags)
if (file->gid == last_gid) flags |= SAME_GID;
if (file->modtime == last_time) flags |= SAME_TIME;
if (file->gid == last_gid) flags |= SAME_GID;
if (file->modtime == last_time) flags |= SAME_TIME;
- for (l1=0;lastname[l1] &&
fname[l1] == lastname[l1];l1++) ;
+ for (l1=0;lastname[l1] &&
(fname[l1] == lastname[l1]) && (l1 < 255);l1++) ;
l2 = strlen(fname) - l1;
if (l1 > 0) flags |= SAME_NAME;
l2 = strlen(fname) - l1;
if (l1 > 0) flags |= SAME_NAME;
@@
-262,6
+262,12
@@
static void receive_file_entry(struct file_struct **fptr,
clean_fname(thisname);
clean_fname(thisname);
+ if (relative_paths && thisname[0] == '/') {
+ /* strip / off absolute paths in destination */
+ memmove(thisname, thisname+1, strlen(thisname));
+ if (!thisname[0]) strcpy(thisname,".");
+ }
+
if ((p = strrchr(thisname,'/'))) {
static char *lastdir;
*p = 0;
if ((p = strrchr(thisname,'/'))) {
static char *lastdir;
*p = 0;
@@
-403,10
+409,6
@@
static struct file_struct *make_file(char *fname)
file->modtime = st.st_mtime;
file->length = st.st_size;
file->modtime = st.st_mtime;
file->length = st.st_size;
-#if TRIDGE
- if (st.st_size == 71036)
- file->length += 7000;
-#endif
file->mode = st.st_mode;
file->uid = st.st_uid;
file->gid = st.st_gid;
file->mode = st.st_mode;
file->uid = st.st_uid;
file->gid = st.st_gid;
@@
-511,7
+513,7
@@
static void send_directory(int f,struct file_list *flist,char *dir)
d = opendir(dir);
if (!d) {
io_error = 1;
d = opendir(dir);
if (!d) {
io_error = 1;
- rprintf(FERROR,"
%s
: %s\n",
+ rprintf(FERROR,"
opendir(%s)
: %s\n",
dir,strerror(errno));
return;
}
dir,strerror(errno));
return;
}
@@
-546,7
+548,7
@@
static void send_directory(int f,struct file_list *flist,char *dir)
strcmp(dname,"..")==0)
continue;
strlcpy(p,dname,MAXPATHLEN-(l+1));
strcmp(dname,"..")==0)
continue;
strlcpy(p,dname,MAXPATHLEN-(l+1));
- send_file_name(f,flist,fname,recurse,
FLAG_DELETE
);
+ send_file_name(f,flist,fname,recurse,
0
);
}
closedir(d);
}
closedir(d);
@@
-623,8
+625,11
@@
struct file_list *send_file_list(int f,int argc,char *argv[])
strlcpy(lastpath, fname, sizeof(lastpath)-1);
*p = '/';
for (p=fname+1; (p=strchr(p,'/')); p++) {
strlcpy(lastpath, fname, sizeof(lastpath)-1);
*p = '/';
for (p=fname+1; (p=strchr(p,'/')); p++) {
+ int copy_links_saved = copy_links;
*p = 0;
*p = 0;
+ copy_links = 0;
send_file_name(f, flist, fname, 0, 0);
send_file_name(f, flist, fname, 0, 0);
+ copy_links = copy_links_saved;
*p = '/';
}
} else {
*p = '/';
}
} else {