Put text of assertion into error message
authoraland <aland>
Mon, 17 Sep 2007 14:35:26 +0000 (14:35 +0000)
committeraland <aland>
Mon, 17 Sep 2007 14:35:26 +0000 (14:35 +0000)
src/include/rad_assert.h
src/main/util.c

index 677f842..1faa7d9 100644 (file)
 #include <freeradius-devel/ident.h>
 RCSIDH(rad_assert_h, "$Id$")
 
-extern void rad_assert_fail (const char *file, unsigned int line);
+extern void rad_assert_fail (const char *file, unsigned int line, const char *expr);
 
 #ifdef NDEBUG
        #define rad_assert(expr) ((void) (0))
 #else
        #define rad_assert(expr) \
                ((void) ((expr) ? (void) 0 : \
-                       (void) rad_assert_fail (__FILE__, __LINE__)))
+                       (void) rad_assert_fail (__FILE__, __LINE__, #expr)))
 #endif
 
 #endif
index aa6370c..da0e363 100644 (file)
@@ -326,9 +326,10 @@ void *rad_malloc(size_t size)
  *
  */
 
-void NEVER_RETURNS rad_assert_fail (const char *file, unsigned int line)
+void NEVER_RETURNS rad_assert_fail (const char *file, unsigned int line,
+                                   const char *expr)
 {
-       radlog(L_ERR|L_CONS, "Assertion failed in %s, line %u", file, line);
+       radlog(L_ERR, "ASSERT FAILED %s[%u]: %s", file, line, expr);
        abort();
 }
 
@@ -416,6 +417,11 @@ REQUEST *request_alloc_fake(REQUEST *request)
   fake->packet->id = fake->number & 0xff;
   fake->packet->code = request->packet->code;
   fake->timestamp = request->timestamp;
+  /*
+   *   Required for new identity support
+   */
+  fake->listener = request->listener;
 
   /*
    *   Fill in the fake reply, based on the fake request.