From edbcdc48f28a257cf862448057f411f0b2a313b2 Mon Sep 17 00:00:00 2001 From: Chris Dunlop Date: Wed, 14 Dec 2011 14:28:39 +1100 Subject: [PATCH] Fix error when running without --link-by-hash Don't pass F_SUM(file) into receive_data() if not using --link-by-hash. When running without --link-by-hash (and without --checksum), F_SUM(file) isn't allocated. However this location was being unconditionally passed into receive_data() which would then write into it, stamping on whatever happened to be there. Signed-off-by: Chris Dunlop --- receiver.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/receiver.c b/receiver.c index a9aae26..a372e00 100644 --- a/receiver.c +++ b/receiver.c @@ -54,6 +54,7 @@ extern int allowed_lull; extern int delay_updates; extern mode_t orig_umask; extern struct stats stats; +extern char *link_by_hash_dir; extern char *tmpdir; extern char *partial_dir; extern char *basis_dir[MAX_BASIS_DIRS+1]; @@ -848,7 +849,8 @@ int recv_files(int f_in, int f_out, char *local_name) /* recv file data */ recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size, - fname, fd2, F_LENGTH(file), F_SUM(file)); + fname, fd2, F_LENGTH(file), + link_by_hash_dir ? F_SUM(file) : NULL); log_item(log_code, file, iflags, NULL); -- 1.7.0.4