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.

63 lines
2.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/0001-make-h_errno-thread-local.patch
  5. # Copyright (C) 2020 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. From 9d0b8b92a508c328e7eac774847f001f80dfb5ff Mon Sep 17 00:00:00 2001
  17. From: Rich Felker <dalias@aerifal.cx>
  18. Date: Mon, 24 Aug 2020 21:38:49 -0400
  19. Subject: [PATCH] make h_errno thread-local
  20. the framework to do this always existed but it was deemed unnecessary
  21. because the only [ex-]standard functions using h_errno were not
  22. thread-safe anyway. however, some of the nonstandard res_* functions
  23. are also supposed to set h_errno to indicate the cause of error, and
  24. were unable to do so because it was not thread-safe. this change is a
  25. prerequisite for fixing them.
  26. ---
  27. src/internal/pthread_impl.h | 1 +
  28. src/network/h_errno.c | 6 ++----
  29. 2 files changed, 3 insertions(+), 4 deletions(-)
  30. diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
  31. index 5742dfc5..5749a336 100644
  32. --- a/src/internal/pthread_impl.h
  33. +++ b/src/internal/pthread_impl.h
  34. @@ -43,6 +43,7 @@ struct pthread {
  35. long off;
  36. volatile void *volatile pending;
  37. } robust_list;
  38. + int h_errno_val;
  39. volatile int timer_id;
  40. locale_t locale;
  41. volatile int killlock[1];
  42. diff --git a/src/network/h_errno.c b/src/network/h_errno.c
  43. index 4f700cea..8677a92b 100644
  44. --- a/src/network/h_errno.c
  45. +++ b/src/network/h_errno.c
  46. @@ -1,9 +1,7 @@
  47. #include <netdb.h>
  48. -
  49. -#undef h_errno
  50. -int h_errno;
  51. +#include "pthread_impl.h"
  52. int *__h_errno_location(void)
  53. {
  54. - return &h_errno;
  55. + return &__pthread_self()->h_errno_val;
  56. }
  57. --
  58. 2.28.0