From 37512c0399662de47eef61e054672968ac07845e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 14 Nov 2013 22:31:29 +0000 Subject: [PATCH] runtime: Don't use filename without '/' for backtrace library. Fixes http://golang.org/issue/6715. From-SVN: r204828 --- libgo/runtime/go-caller.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libgo/runtime/go-caller.c b/libgo/runtime/go-caller.c index 8ca3c7efcd7..c49704df416 100644 --- a/libgo/runtime/go-caller.c +++ b/libgo/runtime/go-caller.c @@ -101,6 +101,13 @@ __go_get_backtrace_state () const char *filename; filename = (const char *) runtime_progname (); + + /* If there is no '/' in FILENAME, it was found on PATH, and + might not be the same as the file with the same name in the + current directory. */ + if (__builtin_strchr (filename, '/') == NULL) + filename = NULL; + back_state = backtrace_create_state (filename, 1, error_callback, NULL); } runtime_unlock (&back_state_lock);