OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../libexecinfo/10-execinfo.patch
  5. # Copyright (C) 2017 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. --- ./execinfo.c.orig
  17. +++ ./execinfo.c
  18. @@ -69,7 +69,8 @@
  19. char **
  20. backtrace_symbols(void *const *buffer, int size)
  21. {
  22. - int i, clen, alen, offset;
  23. + size_t clen, alen;
  24. + int i, offset;
  25. char **rval;
  26. char *cp;
  27. Dl_info info;
  28. @@ -78,7 +79,6 @@
  29. rval = malloc(clen);
  30. if (rval == NULL)
  31. return NULL;
  32. - (char **)cp = &(rval[size]);
  33. for (i = 0; i < size; i++) {
  34. if (dladdr(buffer[i], &info) != 0) {
  35. if (info.dli_sname == NULL)
  36. @@ -92,14 +92,14 @@
  37. 2 + /* " <" */
  38. strlen(info.dli_sname) + /* "function" */
  39. 1 + /* "+" */
  40. - D10(offset) + /* "offset */
  41. + 10 + /* "offset */
  42. 5 + /* "> at " */
  43. strlen(info.dli_fname) + /* "filename" */
  44. 1; /* "\0" */
  45. rval = realloc_safe(rval, clen + alen);
  46. if (rval == NULL)
  47. return NULL;
  48. - snprintf(cp, alen, "%p <%s+%d> at %s",
  49. + snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
  50. buffer[i], info.dli_sname, offset, info.dli_fname);
  51. } else {
  52. alen = 2 + /* "0x" */
  53. @@ -108,12 +108,15 @@
  54. rval = realloc_safe(rval, clen + alen);
  55. if (rval == NULL)
  56. return NULL;
  57. - snprintf(cp, alen, "%p", buffer[i]);
  58. + snprintf((char *) rval + clen, alen, "%p", buffer[i]);
  59. }
  60. - rval[i] = cp;
  61. - cp += alen;
  62. + rval[i] = (char *) clen;
  63. + clen += alen;
  64. }
  65. + for (i = 0; i < size; i++)
  66. + rval[i] += (long) rval;
  67. +
  68. return rval;
  69. }
  70. @@ -155,6 +158,6 @@
  71. return;
  72. snprintf(buf, len, "%p\n", buffer[i]);
  73. }
  74. - write(fd, buf, len - 1);
  75. + write(fd, buf, strlen(buf));
  76. }
  77. }