diff options
Diffstat (limited to 'sysdeps/arm/backtrace.c')
-rw-r--r-- | sysdeps/arm/backtrace.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sysdeps/arm/backtrace.c b/sysdeps/arm/backtrace.c index 7ab487c2fc..a06a01a996 100644 --- a/sysdeps/arm/backtrace.c +++ b/sysdeps/arm/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kazu Hirata <kazu@codesourcery.com>, 2008. @@ -17,7 +17,7 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ -#include <bits/libc-lock.h> +#include <libc-lock.h> #include <dlfcn.h> #include <execinfo.h> #include <stdlib.h> @@ -87,11 +87,13 @@ backtrace_helper (struct _Unwind_Context *ctx, void *a) } int -__backtrace (array, size) - void **array; - int size; +__backtrace (void **array, int size) { struct trace_arg arg = { .array = array, .size = size, .cnt = -1 }; + + if (size <= 0) + return 0; + #ifdef SHARED __libc_once_define (static, once); @@ -100,8 +102,7 @@ __backtrace (array, size) return 0; #endif - if (size >= 1) - unwind_backtrace (backtrace_helper, &arg); + unwind_backtrace (backtrace_helper, &arg); if (arg.cnt > 1 && arg.array[arg.cnt - 1] == NULL) --arg.cnt; |