From: Ben Gras Date: Fri, 24 Feb 2012 12:09:39 +0000 (+0100) Subject: fix for -lsys assert(): call panic() X-Git-Tag: v3.2.1~694 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/verify-sign/verify.pl?a=commitdiff_plain;h=c543dcf2055e19b86cd54a3135fbb7c23ba6da9e;p=minix.git fix for -lsys assert(): call panic() . call panic() instead of abort() so that stacktraces are printed . also call printf(..) instead of fprintf(stderr, ..) --- diff --git a/lib/libsys/assert.c b/lib/libsys/assert.c index 1c314d345..30d98fe1b 100644 --- a/lib/libsys/assert.c +++ b/lib/libsys/assert.c @@ -5,17 +5,6 @@ #include #include -#ifndef __NBSD_LIBC -#include -#include -#include - -void __bad_assertion(const char *mess) { - panic("%s", mess); -} - -#else /* NBSD_LIBC */ - #include #include @@ -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 */