From: hno <> Date: Sat, 19 Aug 2000 12:10:00 +0000 (+0000) Subject: Added a default xmalloc and friends failure_notify handler used when the X-Git-Tag: SQUID_3_0_PRE1~1868 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ac23588efbde650191fe610fe6c27261d451173;p=thirdparty%2Fsquid.git Added a default xmalloc and friends failure_notify handler used when the 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.. --- diff --git a/lib/util.c b/lib/util.c index dcae303f49..04c3a6b5db 100644 --- a/lib/util.c +++ b/lib/util.c @@ -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(); +} +