1 --- assert.c.orig 2010-09-24 10:27:46.000000000 -0700
2 +++ assert.c 2010-09-24 10:37:33.000000000 -0700
3 @@ -34,23 +34,60 @@ static char sccsid[] = "@(#)assert.c 8.1
4 __FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
10 +#include "CrashReporterClient.h"
14 -__assert(func, file, line, failedexpr)
15 +__assert_rtn(func, file, line, failedexpr)
16 const char *func, *file;
18 const char *failedexpr;
21 - (void)fprintf(stderr,
22 + if (func == (const char *)-1L) {
23 + /* 8462256: special case to replace __eprintf */
24 + _simple_dprintf(STDERR_FILENO,
25 + "%s:%u: failed assertion `%s'\n", file, line, failedexpr);
26 + if (!CRGetCrashLogMessage()) {
27 + _SIMPLE_STRING s = _simple_salloc();
30 + "%s:%u: failed assertion `%s'\n",
31 + file, line, failedexpr);
32 + CRSetCrashLogMessage(_simple_string(s));
34 + CRSetCrashLogMessage(failedexpr);
36 + } else if (func == NULL) {
37 + _simple_dprintf(STDERR_FILENO,
38 "Assertion failed: (%s), file %s, line %d.\n", failedexpr,
41 - (void)fprintf(stderr,
42 + if (!CRGetCrashLogMessage()) {
43 + _SIMPLE_STRING s = _simple_salloc();
46 + "Assertion failed: (%s), file %s, line %d.\n",
47 + failedexpr, file, line);
48 + CRSetCrashLogMessage(_simple_string(s));
50 + CRSetCrashLogMessage(failedexpr);
53 + _simple_dprintf(STDERR_FILENO,
54 "Assertion failed: (%s), function %s, file %s, line %d.\n",
55 failedexpr, func, file, line);
56 + if (!CRGetCrashLogMessage()) {
57 + _SIMPLE_STRING s = _simple_salloc();
60 + "Assertion failed: (%s), function %s, file %s, line %d.\n",
61 + failedexpr, func, file, line);
62 + CRSetCrashLogMessage(_simple_string(s));
64 + CRSetCrashLogMessage(failedexpr);