Turn some asserts into descriptive errors.
authorWayne Davison <wayned@samba.org>
Sat, 26 Jun 2010 23:13:58 +0000 (16:13 -0700)
committerWayne Davison <wayned@samba.org>
Sat, 26 Jun 2010 23:13:58 +0000 (16:13 -0700)
hlink.c

diff --git a/hlink.c b/hlink.c
index 0c4ab4d643ebb1a60dc72884c188d36a79e18320..cfa1065e207d6f11c16eb120d967a01f6c5ad699 100644 (file)
--- 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");