Pull in fix from upstream NetBSD rev. 1.5:
If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will return that which poor behavior for the user, so return 0 instead. We could document ~0 to be an error, but that would deviate from the Linux behavior which is not desirable. Noted by Poul-Henning Kamp PR: 209842
This commit is contained in:
parent
6d4b6bd3ce
commit
895a7e604d
@ -67,7 +67,9 @@ backtrace(void **arr, size_t len)
|
||||
ctx.n = (size_t)~0;
|
||||
|
||||
_Unwind_Backtrace(tracer, &ctx);
|
||||
if (ctx.n != (size_t)~0 && ctx.n > 0)
|
||||
if (ctx.n == (size_t)~0)
|
||||
ctx.n = 0;
|
||||
else if (ctx.n > 0)
|
||||
ctx.arr[--ctx.n] = NULL; /* Skip frame below __start */
|
||||
|
||||
return ctx.n;
|
||||
|
Loading…
Reference in New Issue
Block a user