X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/375a4556c7a1ffb9a4e7117f33fc42ed2bc4c026..654175798bdbdd6403e10c8fa74e8586b3612ea1:/receiver.c?ds=sidebyside diff --git a/receiver.c b/receiver.c index 204933ff..189aa417 100644 --- a/receiver.c +++ b/receiver.c @@ -223,7 +223,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname, if (fd != -1 && write_file(fd,data,i) != i) { rprintf(FERROR,"write failed on %s : %s\n",fname,strerror(errno)); - exit_cleanup(1); + exit_cleanup(RERR_FILEIO); } offset += i; continue; @@ -249,7 +249,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname, if (fd != -1 && write_file(fd,map,len) != len) { rprintf(FERROR,"write failed on %s : %s\n", fname,strerror(errno)); - exit_cleanup(1); + exit_cleanup(RERR_FILEIO); } offset += len; } @@ -259,7 +259,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname, if (fd != -1 && offset > 0 && sparse_end(fd) != 0) { rprintf(FERROR,"write failed on %s : %s\n", fname,strerror(errno)); - exit_cleanup(1); + exit_cleanup(RERR_FILEIO); } sum_end(file_sum1); @@ -292,7 +292,9 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen) struct file_struct *file; int phase=0; int recv_ok; - + extern struct stats stats; + struct stats initial_stats; + if (verbose > 2) { rprintf(FINFO,"recv_files(%d) starting\n",flist->count); } @@ -320,7 +322,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen) if (i < 0 || i >= flist->count) { rprintf(FERROR,"Invalid file index %d in recv_files (count=%d)\n", i, flist->count); - exit_cleanup(1); + exit_cleanup(RERR_PROTOCOL); } file = flist->files[i]; @@ -333,11 +335,14 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen) fname = local_name; if (dry_run) { - if (!am_server && verbose) - rprintf(FINFO,"%s\n",fname); + if (!am_server) { + log_transfer(file, fname); + } continue; } + initial_stats = stats; + if (verbose > 2) rprintf(FINFO,"recv_files(%s)\n",fname); @@ -413,11 +418,14 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen) cleanup_set(fnametmp, fname, file, buf, fd1, fd2); - if (!am_server && verbose) - rprintf(FINFO,"%s\n",fname); - + if (!am_server) { + log_transfer(file, fname); + } + /* recv file data */ recv_ok = receive_data(f_in,buf,fd2,fname,file->length); + + log_recv(file, &initial_stats); if (buf) unmap_file(buf); if (fd1 != -1) {