about summary refs log tree commit diff
path: root/sysdeps/m68k/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/m68k/backtrace.c')
-rw-r--r--sysdeps/m68k/backtrace.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/m68k/backtrace.c b/sysdeps/m68k/backtrace.c
index 3114251925..ca7d25929e 100644
--- a/sysdeps/m68k/backtrace.c
+++ b/sysdeps/m68k/backtrace.c
@@ -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;