diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-22 11:32:26 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-22 11:32:55 +0100 |
commit | 9e237b93a53bae03c31e0332b6a98f304157f20c (patch) | |
tree | 85eb0ffa969807d23071face1f69c1795fb4b5e7 /libshouldbeinlibc | |
parent | 7ac6140af72307e147cb31e4d14d2a5a35887e29 (diff) | |
download | hurd-9e237b93a53bae03c31e0332b6a98f304157f20c.tar.gz hurd-9e237b93a53bae03c31e0332b6a98f304157f20c.tar.bz2 hurd-9e237b93a53bae03c31e0332b6a98f304157f20c.zip |
libshouldbeinlibc: Fix printing truncated backtrace
* libshouldbeinlibc/assert-backtrace.c (__assert_fail_base_backtrace):
If returned backtrace is smaller than skip we cannot print anything.
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r-- | libshouldbeinlibc/assert-backtrace.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libshouldbeinlibc/assert-backtrace.c b/libshouldbeinlibc/assert-backtrace.c index ca23c8d2..66ce47c1 100644 --- a/libshouldbeinlibc/assert-backtrace.c +++ b/libshouldbeinlibc/assert-backtrace.c @@ -47,8 +47,11 @@ __assert_fail_base_backtrace (const char *fmt, fprintf (stderr, fmt, program_invocation_name, file, line, function, assertion); - backtrace_symbols_fd (&buffer[skip], nptrs - skip, STDERR_FILENO); - fflush (stderr); + if (nptrs > skip) + { + backtrace_symbols_fd (&buffer[skip], nptrs - skip, STDERR_FILENO); + fflush (stderr); + } /* Die. */ abort (); |