summaryrefslogtreecommitdiff
path: root/sysdeps/m68k/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/m68k/backtrace.c')
-rw-r--r--sysdeps/m68k/backtrace.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sysdeps/m68k/backtrace.c b/sysdeps/m68k/backtrace.c
index 3114251925..7789d08ef6 100644
--- a/sysdeps/m68k/backtrace.c
+++ b/sysdeps/m68k/backtrace.c
@@ -1,5 +1,5 @@
/* Return backtrace of current program state.
- Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ Copyright (C) 2013-2016 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
@@ -16,7 +16,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>
@@ -111,6 +111,10 @@ int
__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);
@@ -119,8 +123,7 @@ __backtrace (void **array, int 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;