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
formatting changes
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
d7da6e8
..
9ebed25
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-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;
@@
-507,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;
}
@@
-521,7
+527,7
@@
static void send_directory(int f,struct file_list *flist,char *dir)
closedir(d);
return;
}
closedir(d);
return;
}
- str
cat(fname,"/"
);
+ str
lcat(fname,"/", MAXPATHLEN-1
);
l++;
}
p = fname + strlen(fname);
l++;
}
p = fname + strlen(fname);
@@
-585,7
+591,7
@@
struct file_list *send_file_list(int f,int argc,char *argv[])
l = strlen(fname);
if (l != 1 && fname[l-1] == '/') {
l = strlen(fname);
if (l != 1 && fname[l-1] == '/') {
- str
cat(fname,"."
);
+ str
lcat(fname,".",MAXPATHLEN-1
);
}
if (link_stat(fname,&st) != 0) {
}
if (link_stat(fname,&st) != 0) {
@@
-616,11
+622,14
@@
struct file_list *send_file_list(int f,int argc,char *argv[])
thus getting their permissions right */
*p = 0;
if (strcmp(lastpath,fname)) {
thus getting their permissions right */
*p = 0;
if (strcmp(lastpath,fname)) {
- str
cpy(lastpath, fname
);
+ str
lcpy(lastpath, fname, sizeof(lastpath)-1
);
*p = '/';
for (p=fname+1; (p=strchr(p,'/')); p++) {
*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 {
@@
-878,7
+887,7
@@
char *f_name(struct file_struct *f)
n = (n+1)%10;
if (f->dirname) {
n = (n+1)%10;
if (f->dirname) {
- s
printf(p
, "%s/%s", f->dirname, f->basename);
+ s
lprintf(p, MAXPATHLEN-1
, "%s/%s", f->dirname, f->basename);
} else {
strlcpy(p, f->basename, MAXPATHLEN-1);
}
} else {
strlcpy(p, f->basename, MAXPATHLEN-1);
}