aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/s390
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2015-08-15 11:42:43 -0700
committerPaul Pluzhnikov <ppluzhnikov@google.com>2015-08-15 11:42:43 -0700
commitd5dff793af80b6534e9fb2e4f0301993bd209a4f (patch)
treec3df534ffb1c966cb96ac71fee5cc0c4f17d3d57 /sysdeps/s390
parent3cda1b6d56335a101ec3de0053248f68f010eee1 (diff)
downloadglibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.tar
glibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.tar.gz
glibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.tar.bz2
glibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.zip
Fix BZ #18084 -- backtrace (..., 0) dumps core on x86.
Other architectures also had bugs, or did unnecessary work.
Diffstat (limited to 'sysdeps/s390')
-rw-r--r--sysdeps/s390/s390-32/backtrace.c7
-rw-r--r--sysdeps/s390/s390-64/backtrace.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/sysdeps/s390/s390-32/backtrace.c b/sysdeps/s390/s390-32/backtrace.c
index 73db65275d..4e5e1feee6 100644
--- a/sysdeps/s390/s390-32/backtrace.c
+++ b/sysdeps/s390/s390-32/backtrace.c
@@ -126,6 +126,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);
@@ -135,8 +139,7 @@ __backtrace (void **array, int size)
return __backchain_backtrace (array, size);
#endif
- if (size >= 1)
- unwind_backtrace (backtrace_helper, &arg);
+ unwind_backtrace (backtrace_helper, &arg);
return arg.cnt != -1 ? arg.cnt : 0;
}
diff --git a/sysdeps/s390/s390-64/backtrace.c b/sysdeps/s390/s390-64/backtrace.c
index 08e563e0df..184a73741b 100644
--- a/sysdeps/s390/s390-64/backtrace.c
+++ b/sysdeps/s390/s390-64/backtrace.c
@@ -125,6 +125,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);
@@ -134,8 +138,7 @@ __backtrace (void **array, int size)
return __backchain_backtrace (array, size);
#endif
- if (size >= 1)
- unwind_backtrace (backtrace_helper, &arg);
+ unwind_backtrace (backtrace_helper, &arg);
return arg.cnt != -1 ? arg.cnt : 0;
}