diff options
author | Ian Lance Taylor <iant@google.com> | 2012-11-12 21:24:19 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-11-12 21:24:19 +0000 |
commit | 33521509a82eeed8e657642db2c2846cc9685bab (patch) | |
tree | 33eae4f1dfeddbcdd692656a204db81bdd98f92d /libbacktrace/print.c | |
parent | 211d71a745167d6bb935ddf21b7d7f6dd5168969 (diff) |
configure.ac: Check for getexecname.
* configure.ac: Check for getexecname.
* fileline.c: #include <errno.h>. Define getexecname if not
available.
(fileline_initialize): Try to find the executable in a few
different ways.
* print.c (error_callback): Only print the filename if it came
from the backtrace state.
* configure, config.h.in: Rebuild.
Co-Authored-By: Gerald Pfeifer <gerald@pfeifer.com>
Co-Authored-By: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
From-SVN: r193454
Diffstat (limited to 'libbacktrace/print.c')
-rw-r--r-- | libbacktrace/print.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libbacktrace/print.c b/libbacktrace/print.c index 2d9d76aeba7..9b775584d47 100644 --- a/libbacktrace/print.c +++ b/libbacktrace/print.c @@ -69,12 +69,10 @@ static void error_callback (void *data, const char *msg, int errnum) { struct print_data *pdata = (struct print_data *) data; - const char *name; - name = pdata->state->filename; - if (name == NULL) - name = "/proc/self/exe"; - fprintf (stderr, "%s: libbacktrace: %s", name, msg); + if (pdata->state->filename != NULL) + fprintf (stderr, "%s: ", pdata->state->filename); + fprintf (stderr, "libbacktrace: %s", msg); if (errnum > 0) fprintf (stderr, ": %s", strerror (errnum)); fputc ('\n', stderr); |