0003-look-for-pthread-atfork-also-in-libc-nonshared.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From a844abca43349739c36a4cdb7ea6f3bce560bd7f Mon Sep 17 00:00:00 2001
  2. From: Rolf Eike Beer <eb@emlix.com>
  3. Date: Thu, 8 Nov 2018 08:14:46 +0100
  4. Subject: [PATCH] look for pthread_atfork() also in lib c_nonshared
  5. Newer versions of glibc do not have pthread_nonshared anymore, instead the
  6. symbol is in c_nonshared. This fixes a crash on start on those platforms
  7. (namely with syslog-ng).
  8. Signed-off-by: Rolf Eike Beer <eb@emlix.com>
  9. [ThomasDS: backport from https://github.com/buytenh/ivykis/pull/16, at this
  10. moment not yet merged upstream.
  11. See also:
  12. - https://github.com/buytenh/ivykis/issues/15
  13. - https://github.com/balabit/syslog-ng/issues/2263
  14. ]
  15. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
  16. ---
  17. configure.ac | 2 ++
  18. src/pthr.h | 2 +-
  19. 2 files changed, 3 insertions(+), 1 deletion(-)
  20. diff --git a/lib/ivykis/configure.ac b/lib/ivykis/configure.ac
  21. index e9b10c0..56440d1 100644
  22. --- a/lib/ivykis/configure.ac
  23. +++ b/lib/ivykis/configure.ac
  24. @@ -88,6 +88,8 @@ esac
  25. # link in libpthread_nonshared.a if it is available.
  26. #
  27. AC_CHECK_LIB([pthread_nonshared], [pthread_atfork])
  28. +# the lib is gone in glibc 2.28, things are now in c_nonshared
  29. +AC_CHECK_LIB([c_nonshared], [pthread_atfork])
  30. # Checks for header files.
  31. AC_CHECK_HEADERS([process.h])
  32. diff --git a/lib/ivykis/src/pthr.h b/lib/ivykis/src/pthr.h
  33. index a41eaf3..32c1af2 100644
  34. --- a/lib/ivykis/src/pthr.h
  35. +++ b/lib/ivykis/src/pthr.h
  36. @@ -42,7 +42,7 @@ static inline int pthreads_available(void)
  37. * symbol because that causes it to be undefined even if you link
  38. * libpthread_nonshared.a in explicitly.
  39. */
  40. -#ifndef HAVE_LIBPTHREAD_NONSHARED
  41. +#if !defined(HAVE_LIBPTHREAD_NONSHARED) && !defined(HAVE_LIBC_NONSHARED)
  42. #pragma weak pthread_atfork
  43. #endif