|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../libexecinfo/10-execinfo.patch # Copyright (C) 2017 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END ---
--- ./execinfo.c.orig
+++ ./execinfo.c
@@ -69,7 +69,8 @@
char ** backtrace_symbols(void *const *buffer, int size) { - int i, clen, alen, offset;
+ size_t clen, alen;
+ int i, offset;
char **rval; char *cp; Dl_info info; @@ -78,7 +79,6 @@
rval = malloc(clen); if (rval == NULL) return NULL; - (char **)cp = &(rval[size]);
for (i = 0; i < size; i++) { if (dladdr(buffer[i], &info) != 0) { if (info.dli_sname == NULL) @@ -92,14 +92,14 @@
2 + /* " <" */ strlen(info.dli_sname) + /* "function" */ 1 + /* "+" */ - D10(offset) + /* "offset */
+ 10 + /* "offset */
5 + /* "> at " */ strlen(info.dli_fname) + /* "filename" */ 1; /* "\0" */ rval = realloc_safe(rval, clen + alen); if (rval == NULL) return NULL; - snprintf(cp, alen, "%p <%s+%d> at %s",
+ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
buffer[i], info.dli_sname, offset, info.dli_fname); } else { alen = 2 + /* "0x" */ @@ -108,12 +108,15 @@
rval = realloc_safe(rval, clen + alen); if (rval == NULL) return NULL; - snprintf(cp, alen, "%p", buffer[i]);
+ snprintf((char *) rval + clen, alen, "%p", buffer[i]);
} - rval[i] = cp;
- cp += alen;
+ rval[i] = (char *) clen;
+ clen += alen;
} + for (i = 0; i < size; i++)
+ rval[i] += (long) rval;
+
return rval; } @@ -155,6 +158,6 @@
return; snprintf(buf, len, "%p\n", buffer[i]); } - write(fd, buf, len - 1);
+ write(fd, buf, strlen(buf));
} }
|