Skip to content

Commit

Permalink
Add a placeholder text for print_backtrace()...
Browse files Browse the repository at this point in the history
in case backtrace(3) returns a zero or negative "nptrs" value.
  • Loading branch information
Explorer09 committed Aug 12, 2024
1 parent f18a1f4 commit 2b526ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CRT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,13 @@ static void print_backtrace(void) {
void* backtraceArray[256];

int nptrs = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
backtrace_symbols_fd(backtraceArray, nptrs, STDERR_FILENO);
if (nptrs > 0) {
backtrace_symbols_fd(backtraceArray, nptrs, STDERR_FILENO);
} else {
full_write_str(STDERR_FILENO,
"[No backtrace information available from libc]\n"
);
}
#else
#error No implementation for print_backtrace()!
#endif
Expand Down

0 comments on commit 2b526ba

Please sign in to comment.