diff options
Diffstat (limited to 'libc/misc/assert')
-rw-r--r-- | libc/misc/assert/__assert.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index 26bcc6516..74b5ee86f 100644 --- a/libc/misc/assert/__assert.c +++ b/libc/misc/assert/__assert.c @@ -46,21 +46,27 @@ extern const char *__progname; #if 1 +static int in_assert; /* bss inits to 0. */ + void __assert(const char *assertion, const char * filename, int linenumber, register const char * function) { - fprintf(stderr, + if (!in_assert) { + in_assert = 1; + + fprintf(stderr, #ifdef ASSERT_SHOW_PROGNAME - "%s: %s: %d: %s: Assertion `%s' failed.\n", __progname, + "%s: %s: %d: %s: Assertion `%s' failed.\n", __progname, #else - "%s: %d: %s: Assertion `%s' failed.\n", + "%s: %d: %s: Assertion `%s' failed.\n", #endif - filename, - linenumber, - /* Function name isn't available with some compilers. */ - ((function == NULL) ? "?function?" : function), - assertion - ); + filename, + linenumber, + /* Function name isn't available with some compilers. */ + ((function == NULL) ? "?function?" : function), + assertion + ); + } abort(); } |