diff -up glibc-2.10-288-ga0e25a8/assert/assert.c.jx glibc-2.10-288-ga0e25a8/assert/assert.c --- glibc-2.10-288-ga0e25a8/assert/assert.c.jx 2009-08-23 19:33:50.000000000 -0400 +++ glibc-2.10-288-ga0e25a8/assert/assert.c 2009-08-25 13:54:29.000000000 -0400 @@ -44,32 +44,35 @@ extern const char *__progname; # include FATAL_PREPARE_INCLUDE #endif +#define ASSERT_FORMAT \ + _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"), \ + __progname, __progname[0] ? ": " : "", \ + file, line, \ + function ? function : "", function ? ": " : "", \ + assertion #undef __assert_fail void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function) { - char *buf; + int size; #ifdef FATAL_PREPARE FATAL_PREPARE; #endif - if (__asprintf (&buf, _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"), - __progname, __progname[0] ? ": " : "", - file, line, - function ? function : "", function ? ": " : "", - assertion) >= 0) + size = __sprintf(NULL, ASSERT_FORMAT); + + if (size >= 0) { + char buf[size]; + + (void ) __sprintf(buf, ASSERT_FORMAT); + /* Print the message. */ (void) __fxprintf (NULL, "%s", buf); (void) fflush (stderr); - - /* We have to free the old buffer since the application might - catch the SIGABRT signal. */ - char *old = atomic_exchange_acq (&__abort_msg, buf); - free (old); } else { diff -up glibc-2.10-288-ga0e25a8/assert/assert-perr.c.jx glibc-2.10-288-ga0e25a8/assert/assert-perr.c --- glibc-2.10-288-ga0e25a8/assert/assert-perr.c.jx 2009-08-23 19:33:50.000000000 -0400 +++ glibc-2.10-288-ga0e25a8/assert/assert-perr.c 2009-08-25 14:02:37.000000000 -0400 @@ -43,6 +43,13 @@ extern const char *__progname; # include FATAL_PREPARE_INCLUDE #endif +#define ASSERT_PERROR_FORMAT \ + _("%s%s%s:%u: %s%sUnexpected error: %s.\n"), \ + __progname, __progname[0] ? ": " : "", \ + file, line, \ + function ? function : "", function ? ": " : "", \ + errbuf + void __assert_perror_fail (int errnum, const char *file, unsigned int line, @@ -51,24 +58,22 @@ __assert_perror_fail (int errnum, char errbuf[1024]; char *buf; + (void) __strerror_r (errnum, errbuf, sizeof errbuf); + + size = __sprintf(NULL, ASSERT_PERROR_FORMAT); + #ifdef FATAL_PREPARE FATAL_PREPARE; #endif - if (__asprintf (&buf, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"), - __progname, __progname[0] ? ": " : "", - file, line, - function ? function : "", function ? ": " : "", - __strerror_r (errnum, errbuf, sizeof errbuf)) >= 0) + if (size >= 0) { + char buf[size]; + + (void) __sprintf (buf, ASSERT_PERROR_FORMAT); /* Print the message. */ (void) __fxprintf (NULL, "%s", buf); (void) fflush (stderr); - - /* We have to free the old buffer since the application might - catch the SIGABRT signal. */ - char *old = atomic_exchange_acq (&__abort_msg, buf); - free (old); } else {