X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7a6421fa764dd0f609e2a5024ec8b3bc577575a1..de5fb3744da115dbdb66c7fbb894bf2ad9317fb7:/flist.c diff --git a/flist.c b/flist.c index 15c56c8e..d3c07edc 100644 --- a/flist.c +++ b/flist.c @@ -262,6 +262,12 @@ static void receive_file_entry(struct file_struct **fptr, 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; @@ -521,7 +527,7 @@ static void send_directory(int f,struct file_list *flist,char *dir) closedir(d); return; } - strcat(fname,"/"); + strlcat(fname,"/", MAXPATHLEN-1); l++; } p = fname + strlen(fname); @@ -573,6 +579,10 @@ struct file_list *send_file_list(int f,int argc,char *argv[]) flist->malloced); if (!flist->files) out_of_memory("send_file_list"); + if (f != -1) { + io_start_buffering(f); + } + for (i=0;i 2) rprintf(FINFO,"send_file_list done\n"); @@ -870,9 +884,9 @@ char *f_name(struct file_struct *f) n = (n+1)%10; if (f->dirname) { - sprintf(p, "%s/%s", f->dirname, f->basename); + slprintf(p, MAXPATHLEN-1, "%s/%s", f->dirname, f->basename); } else { - strcpy(p, f->basename); + strlcpy(p, f->basename, MAXPATHLEN-1); } return p;