From: Wayne Davison Date: Sat, 26 Jun 2010 23:13:58 +0000 (-0700) Subject: Turn some asserts into descriptive errors. X-Git-Tag: v3.0.8pre1~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d9207bd3837f22e54d7082998b73400ae64fa89;p=thirdparty%2Frsync.git Turn some asserts into descriptive errors. --- 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");