0001-build-Add-rawmemchr-to-missing.h.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 3916c1cc32be205e185a8a56de5cde1b9ec60e81 Mon Sep 17 00:00:00 2001
  2. From: Denis Kenzior <denkenz@gmail.com>
  3. Date: Mon, 30 Nov 2020 13:00:11 -0600
  4. Subject: [PATCH] build: Add rawmemchr to missing.h
  5. For those systems (i.e. musl) that do not support this
  6. [Upstream: https://git.kernel.org/pub/scm/libs/ell/ell.git/patch/?id=3916c1cc32be205e185a8a56de5cde1b9ec60e81]
  7. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  8. ---
  9. configure.ac | 1 +
  10. ell/missing.h | 10 ++++++++++
  11. 2 files changed, 11 insertions(+)
  12. diff --git a/configure.ac b/configure.ac
  13. index 1e5ead9..f34add1 100644
  14. --- a/configure.ac
  15. +++ b/configure.ac
  16. @@ -98,6 +98,7 @@ AC_ARG_ENABLE(ubsan, AC_HELP_STRING([--enable-ubsan],
  17. ])
  18. AC_CHECK_FUNCS(explicit_bzero)
  19. +AC_CHECK_FUNCS(rawmemchr)
  20. AC_CHECK_FUNC(signalfd, dummy=yes,
  21. AC_MSG_ERROR(signalfd support is required))
  22. diff --git a/ell/missing.h b/ell/missing.h
  23. index 6b9b0fd..2a3e647 100644
  24. --- a/ell/missing.h
  25. +++ b/ell/missing.h
  26. @@ -67,3 +67,13 @@ static inline void explicit_bzero(void *s, size_t n)
  27. #ifndef SO_BINDTOIFINDEX
  28. #define SO_BINDTOIFINDEX 62
  29. #endif
  30. +
  31. +#ifndef HAVE_RAWMEMCHR
  32. +static inline void *rawmemchr(const void *s, int c)
  33. +{
  34. +_Pragma("GCC diagnostic push")
  35. +_Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"")
  36. + return memchr(s, c, (size_t) -1);
  37. +_Pragma("GCC diagnostic pop")
  38. +}
  39. +#endif
  40. --
  41. 2.29.2