From f52bb5ce10c3d99dbab9d370541b70d4cfb5efe4 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 22 Jan 2019 21:50:17 -0500 Subject: [PATCH] libroot: Call abort() instead of debugger() from assert(). As per the POSIX specification. This gives the calling program a chance to catch the assertion. But in the case where no signal handler is installed for SIGABRT, we will call debugger() anyway and present as a crash as before. Fixes #10295. --- src/system/libroot/posix/assert.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/system/libroot/posix/assert.c b/src/system/libroot/posix/assert.c index abefb7333d..82fc6a474e 100644 --- a/src/system/libroot/posix/assert.c +++ b/src/system/libroot/posix/assert.c @@ -1,7 +1,7 @@ -/* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ +/* + * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #undef NDEBUG @@ -22,7 +22,7 @@ __assert_fail(const char *assertion, const char *file, unsigned int line, const char *function) { fprintf(stderr, "%s: %s:%d:%s: %s\n", __progname, file, line, function, assertion); - debugger(assertion); + abort(); } @@ -31,5 +31,5 @@ __assert_perror_fail(int error, const char *file, unsigned int line, const char *function) { fprintf(stderr, "%s: %s:%d:%s: %s\n", __progname, file, line, function, strerror(error)); - debugger(strerror(error)); + abort(); }