X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/e45e0093094fd7e7dd44531bff74188b67869cc4..49d11b78c14e6d039f49ea5615bb33148f898bd0:/flist.c diff --git a/flist.c b/flist.c index 4c2e984c..a185082b 100644 --- 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; - 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; @@ -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; @@ -507,7 +513,7 @@ static void send_directory(int f,struct file_list *flist,char *dir) d = opendir(dir); if (!d) { io_error = 1; - rprintf(FERROR,"%s: %s\n", + rprintf(FERROR,"opendir(%s): %s\n", dir,strerror(errno)); return; } @@ -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,7 +887,7 @@ 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 { strlcpy(p, f->basename, MAXPATHLEN-1); }