From 48dcd0ba84c5a0fa08a0bd000b24af07d20dce44 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Jun 2009 16:17:09 -0700 Subject: Preserve message printed before abort. The terminal output etc is not visible in a core file. The new libc-internal variable __abort_msg will point to a string with the message which has been printed before the abort in case abort is called from inside libc. BZ #10217 --- assert/assert-perr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'assert/assert-perr.c') diff --git a/assert/assert-perr.c b/assert/assert-perr.c index dd54246360..f239fab86b 100644 --- a/assert/assert-perr.c +++ b/assert/assert-perr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-1998,2001,2002,2005 Free Software Foundation, Inc. +/* Copyright (C) 1994-1998,2001,2002,2005,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,6 +17,7 @@ 02111-1307 USA. */ #include +#include #include #include #include @@ -64,9 +65,10 @@ __assert_perror_fail (int errnum, (void) __fxprintf (NULL, "%s", buf); (void) fflush (stderr); - /* We have to free the buffer since the appplication might catch the - SIGABRT. */ - free (buf); + /* 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 { -- cgit v1.2.3