aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2010-06-26 16:13:58 -0700
committerWayne Davison <wayned@samba.org>2010-06-26 16:13:58 -0700
commit6d9207bd3837f22e54d7082998b73400ae64fa89 (patch)
tree2a5b752c76310e9a74f72f1b512b8c02bff4bdc1
parent6b8756674421b575a9ea92cfc2cc62a179df18e4 (diff)
downloadandroid_external_rsync-6d9207bd3837f22e54d7082998b73400ae64fa89.tar.gz
android_external_rsync-6d9207bd3837f22e54d7082998b73400ae64fa89.tar.bz2
android_external_rsync-6d9207bd3837f22e54d7082998b73400ae64fa89.zip
Turn some asserts into descriptive errors.
-rw-r--r--hlink.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/hlink.c b/hlink.c
index 0c4ab4d6..cfa1065e 100644
--- a/hlink.c
+++ b/hlink.c
@@ -534,8 +534,19 @@ void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
if (inc_recurse) {
int gnum = F_HL_GNUM(file);
struct ht_int32_node *node = hashtable_find(prior_hlinks, gnum, 0);
- assert(node != NULL && node->data != NULL);
- assert(CVAL(node->data, 0) == 0);
+ if (node == NULL) {
+ rprintf(FERROR, "Unable to find a hlink node for %d (%s)\n", gnum, f_name(file, prev_name));
+ exit_cleanup(RERR_MESSAGEIO);
+ }
+ if (node->data == NULL) {
+ rprintf(FERROR, "Hlink node data for %d is NULL (%s)\n", gnum, f_name(file, prev_name));
+ exit_cleanup(RERR_MESSAGEIO);
+ }
+ if (CVAL(node->data, 0) != 0) {
+ rprintf(FERROR, "Hlink node data for %d already has path=%s (%s)\n",
+ gnum, (char*)node->data, f_name(file, prev_name));
+ exit_cleanup(RERR_MESSAGEIO);
+ }
free(node->data);
if (!(node->data = strdup(our_name)))
out_of_memory("finish_hard_link");