etc: Enable a tty for a serial port by default.
[dragora.git] / patches / libexecinfo / 01-execinfo.patch
blobda91ba0fe34e93ae66d33bae817c79cd327c134c
1 --- a/execinfo.c
2 +++ b/execinfo.c
3 @@ -69,7 +69,8 @@
4 char **
5 backtrace_symbols(void *const *buffer, int size)
7 - int i, clen, alen, offset;
8 + size_t clen, alen;
9 + int i, offset;
10 char **rval;
11 char *cp;
12 Dl_info info;
13 @@ -78,7 +79,6 @@
14 rval = malloc(clen);
15 if (rval == NULL)
16 return NULL;
17 - (char **)cp = &(rval[size]);
18 for (i = 0; i < size; i++) {
19 if (dladdr(buffer[i], &info) != 0) {
20 if (info.dli_sname == NULL)
21 @@ -92,14 +92,14 @@
22 2 + /* " <" */
23 strlen(info.dli_sname) + /* "function" */
24 1 + /* "+" */
25 - D10(offset) + /* "offset */
26 + 10 + /* "offset */
27 5 + /* "> at " */
28 strlen(info.dli_fname) + /* "filename" */
29 1; /* "\0" */
30 rval = realloc_safe(rval, clen + alen);
31 if (rval == NULL)
32 return NULL;
33 - snprintf(cp, alen, "%p <%s+%d> at %s",
34 + snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
35 buffer[i], info.dli_sname, offset, info.dli_fname);
36 } else {
37 alen = 2 + /* "0x" */
38 @@ -108,12 +108,15 @@
39 rval = realloc_safe(rval, clen + alen);
40 if (rval == NULL)
41 return NULL;
42 - snprintf(cp, alen, "%p", buffer[i]);
43 + snprintf((char *) rval + clen, alen, "%p", buffer[i]);
45 - rval[i] = cp;
46 - cp += alen;
47 + rval[i] = (char *) clen;
48 + clen += alen;
51 + for (i = 0; i < size; i++)
52 + rval[i] += (long) rval;
54 return rval;
57 @@ -155,6 +158,6 @@
58 return;
59 snprintf(buf, len, "%p\n", buffer[i]);
61 - write(fd, buf, len - 1);
62 + write(fd, buf, strlen(buf));