diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-04-09 00:38:40 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-04-09 00:38:40 +0000 |
commit | 1250f24ed206648a05a8872bb71a520d0764eff7 (patch) | |
tree | 1d88e46dcdcd7356b9928363a36a344e9ef9ecc7 /flist.c | |
parent | 945eba8c1fc170872a6af23dcfc74b47240c9436 (diff) | |
download | rsync-1250f24ed206648a05a8872bb71a520d0764eff7.tar.gz rsync-1250f24ed206648a05a8872bb71a520d0764eff7.tar.bz2 rsync-1250f24ed206648a05a8872bb71a520d0764eff7.zip |
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.
Diffstat (limited to 'flist.c')
-rw-r--r-- | flist.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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) { |