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