This should fix the bug where file transfer with compression failed with
[rsync/rsync.git] / rsync.c
diff --git a/rsync.c b/rsync.c
index 1975d47..b687fdf 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -257,7 +257,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
   struct stat st;
   struct map_struct *buf;
   struct sum_struct *s;
-  char sum[SUM_LENGTH];
+  char sum[MD4_SUM_LENGTH];
   int statret;
   struct file_struct *file = &flist->files[i];
 
@@ -408,8 +408,8 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
   off_t offset = 0;
   off_t offset2;
   char *data;
-  static char file_sum1[SUM_LENGTH];
-  static char file_sum2[SUM_LENGTH];
+  static char file_sum1[MD4_SUM_LENGTH];
+  static char file_sum2[MD4_SUM_LENGTH];
   char *map=NULL;
 
   count = read_int(f_in);
@@ -443,6 +443,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
 
       map = map_ptr(buf,offset2,len);
 
+      see_token(map, len);
       sum_update(map,len);
 
       if (write_sparse(fd,map,len) != len) {
@@ -461,10 +462,10 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
   sum_end(file_sum1);
 
   if (remote_version >= 14) {
-    read_buf(f_in,file_sum2,SUM_LENGTH);
+    read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
     if (verbose > 2)
       fprintf(FERROR,"got file_sum\n");
-    if (memcmp(file_sum1,file_sum2,SUM_LENGTH) != 0)
+    if (memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0)
       return 0;
   }
   return 1;
@@ -499,7 +500,7 @@ static void delete_files(struct file_list *flist)
   if (cvs_exclude)
     add_cvs_excludes();
 
-  if (!(local_file_list = send_file_list(-1,recurse,1,&dot)))
+  if (!(local_file_list = send_file_list(-1,1,&dot)))
     return;
 
   for (i=local_file_list->count;i>=0;i--) {
@@ -650,6 +651,8 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
       if (!recv_ok) {
        if (verbose > 1)
          fprintf(FERROR,"redoing %s(%d)\n",fname,i);
+        if (csum_length == SUM_LENGTH)
+         fprintf(FERROR,"ERROR: file corruption in %s\n",fname);
        write_int(f_gen,i);
       }
     }