fix for -lsys assert(): call panic()

. call panic() instead of abort() so that stacktraces are printed
	. also call printf(..) instead of fprintf(stderr, ..)
This commit is contained in:
Ben Gras 2012-02-24 13:09:39 +01:00
parent a64ad3054b
commit c543dcf205

View file

@ -5,17 +5,6 @@
#include <assert.h>
#include <stdio.h>
#ifndef __NBSD_LIBC
#include <minix/config.h>
#include <minix/const.h>
#include <minix/sysutil.h>
void __bad_assertion(const char *mess) {
panic("%s", mess);
}
#else /* NBSD_LIBC */
#include <sys/types.h>
#include <stdlib.h>
@ -24,14 +13,10 @@ __assert13(file, line, function, failedexpr)
const char *file, *function, *failedexpr;
int line;
{
(void)fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d%s%s%s\n",
failedexpr, file, line,
function ? ", function \"" : "",
function ? function : "",
function ? "\"" : "");
abort();
(void)printf("%s:%d: assert \"%s\" failed", file, line, failedexpr);
if(function) printf(", function \"%s\"", function);
printf("\n");
panic("assert failed");
/* NOTREACHED */
}
@ -44,5 +29,3 @@ __assert(file, line, failedexpr)
__assert13(file, line, NULL, failedexpr);
/* NOTREACHED */
}
#endif /* NBSD_LIBC */