#endif
if (always_checksum) {
- write_buf(f,file->sum,csum_length);
+ write_buf(f,file->sum,csum_length);
}
last_mode = file->mode;
bzero((char *)file,sizeof(*file));
(*fptr) = file;
+ if (l2 >= MAXPATHLEN-l1) overflow("receive_file_entry");
+
strncpy(thisname,lastname,l1);
- read_buf(f,&thisname[l1],l2);
+ read_sbuf(f,&thisname[l1],l2);
thisname[l1+l2] = 0;
strncpy(lastname,thisname,MAXPATHLEN-1);
int l = read_int(f);
file->link = (char *)malloc(l+1);
if (!file->link) out_of_memory("receive_file_entry 2");
- read_buf(f,file->link,l);
- file->link[l] = 0;
+ read_sbuf(f,file->link,l);
}
#if SUPPORT_HARD_LINKS
}
#endif
- if (always_checksum && S_ISREG(st.st_mode)) {
+ if (always_checksum) {
file->sum = (char *)malloc(MD4_SUM_LENGTH);
if (!file->sum) out_of_memory("md4 sum");
- file_checksum(fname,file->sum,st.st_size);
+ /* drat. we have to provide a null checksum for non-regular
+ files in order to be compatible with earlier versions
+ of rsync */
+ if (S_ISREG(st.st_mode)) {
+ file_checksum(fname,file->sum,st.st_size);
+ } else {
+ memset(file->sum, 0, MD4_SUM_LENGTH);
+ }
}
if (flist_dir) {