X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/8bf737494f17ca384b30db13b4bc31a5158f3646..ce2ac5ac3ff1f4e3a14eb9b316de6804ca747181:/flist.c diff --git a/flist.c b/flist.c index 59e451b1..1ae8c341 100644 --- a/flist.c +++ b/flist.c @@ -41,6 +41,7 @@ extern int preserve_devices; extern int preserve_uid; extern int preserve_gid; extern int preserve_times; +extern int relative_paths; static char **local_exclude_list = NULL; @@ -315,15 +316,18 @@ static void send_file_name(int f,struct file_list *flist,char *fname) if (!file) return; if (flist->count >= flist->malloced) { - flist->malloced += 100; - flist->files = (struct file_struct *)realloc(flist->files, - sizeof(flist->files[0])* - flist->malloced); - if (!flist->files) - out_of_memory("send_file_name"); + if (flist->malloced < 100) + flist->malloced += 100; + else + flist->malloced *= 1.8; + flist->files = (struct file_struct *)realloc(flist->files, + sizeof(flist->files[0])* + flist->malloced); + if (!flist->files) + out_of_memory("send_file_name"); } - if (strcmp(file->name,".") && strcmp(file->name,"/")) { + if (strcmp(file->name,"/")) { flist->files[flist->count++] = *file; send_file_entry(file,f); } @@ -421,15 +425,19 @@ struct file_list *send_file_list(int f,int argc,char *argv[]) } dir = NULL; - p = strrchr(fname,'/'); - if (p) { - *p = 0; - if (p == fname) - dir = "/"; - else - dir = fname; - fname = p+1; + + if (!relative_paths) { + p = strrchr(fname,'/'); + if (p) { + *p = 0; + if (p == fname) + dir = "/"; + else + dir = fname; + fname = p+1; + } } + if (!*fname) fname = "."; @@ -499,12 +507,15 @@ struct file_list *recv_file_list(int f) int i = flist->count; if (i >= flist->malloced) { - flist->malloced += 100; - flist->files =(struct file_struct *)realloc(flist->files, - sizeof(flist->files[0])* - flist->malloced); - if (!flist->files) - goto oom; + if (flist->malloced < 100) + flist->malloced += 100; + else + flist->malloced *= 1.8; + flist->files =(struct file_struct *)realloc(flist->files, + sizeof(flist->files[0])* + flist->malloced); + if (!flist->files) + goto oom; } receive_file_entry(&flist->files[i],flags,f);