From 1250f24ed206648a05a8872bb71a520d0764eff7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 9 Apr 1998 00:38:40 +0000 Subject: [PATCH] fixed a bug in handling the -c option and non-regular files. It hadn't turned up before because Linux had a bug in the handling of NULL pointers to read()/write() on pipes, so I never noticed the bug in my testing. I've also sent a patch to Linus. --- flist.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/flist.c b/flist.c index 3e3b3a68..63b86633 100644 --- a/flist.c +++ b/flist.c @@ -209,7 +209,7 @@ void send_file_entry(struct file_struct *file,int f) #endif if (always_checksum) { - write_buf(f,file->sum,csum_length); + write_buf(f,file->sum,csum_length); } last_mode = file->mode; @@ -426,10 +426,17 @@ static struct file_struct *make_file(char *fname) } #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) { -- 2.34.1