svn commit: r365952 - head/contrib/libexecinfo
Poul-Henning Kamp
phk at FreeBSD.org
Mon Sep 21 16:43:39 UTC 2020
Author: phk
Date: Mon Sep 21 16:43:38 2020
New Revision: 365952
URL: https://svnweb.freebsd.org/changeset/base/365952
Log:
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
Modified:
head/contrib/libexecinfo/unwind.c
Modified: head/contrib/libexecinfo/unwind.c
==============================================================================
--- head/contrib/libexecinfo/unwind.c Mon Sep 21 15:53:41 2020 (r365951)
+++ head/contrib/libexecinfo/unwind.c Mon Sep 21 16:43:38 2020 (r365952)
@@ -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;
More information about the svn-src-all
mailing list