]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added a default xmalloc and friends failure_notify handler used when the
authorhno <>
Sat, 19 Aug 2000 12:10:00 +0000 (12:10 +0000)
committerhno <>
Sat, 19 Aug 2000 12:10:00 +0000 (12:10 +0000)
main program hasn't installed one. These functions are used by more binaries
than the main Squid binary, and not all (only the squid binary) installs
a failure_notify handler. The others cause a SEGV when trying to call
the non-existant failure_notify handler..

lib/util.c

index dcae303f49c31e6486ee92e250c8b1137a9415fa..04c3a6b5dbe7a3cc3bd57ced3bd885aa319ba2f3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: util.c,v 1.70 2000/07/18 06:16:40 wessels Exp $
+ * $Id: util.c,v 1.71 2000/08/19 06:10:00 hno Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -70,7 +70,9 @@
 #include "util.h"
 #include "snprintf.h"
 
-void (*failure_notify) (const char *) = NULL;
+static void default_failure_notify(const char *);
+
+void (*failure_notify) (const char *) = default_failure_notify;
 static char msg[128];
 
 #if !defined(__CYGWIN__)
@@ -724,3 +726,12 @@ xitoa(int num)
     snprintf(buf, sizeof(buf), "%d", num);
     return buf;
 }
+
+/* A default failure notifier when the main program hasn't installed any */
+void default_failure_notify(const char *msg)
+{
+    write(2, msg, strlen(msg));
+    write(2, "\n", 1);
+    abort();
+}
+