PageRenderTime 49ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/net-misc/iputils/files/iputils-20180629-fix-ping-on-musl.patch

https://gitlab.com/argent/portage
Patch | 54 lines | 46 code | 8 blank | 0 comment | 0 complexity | 5faa55419cc427700bc4b3890716bddd MD5 | raw file
  1. From 25899e849aa3abc1ad29ebf0b830262a859eaed5 Mon Sep 17 00:00:00 2001
  2. From: Petr Vorel <petr.vorel@gmail.com>
  3. Date: Sat, 21 Jul 2018 17:46:14 +0200
  4. Subject: [PATCH] ping: Fix AI_CANONIDN usage on some systems
  5. Commit 99f67db used AI_CANONIDN in a way, which broke compilation on
  6. systems where AI_CANONIDN is not defined in netdb.h (e.g. glibc < 2.3.4,
  7. alternative libcs that don't support IDN: e.g. current musl 1.1.19 and
  8. uClibc-ng 1.0.30) when not using the system libidn2.
  9. Fixes: 99f67db ping: Fix ping name encoded using ACE on C locale
  10. Reported-by: Nicholas Fish
  11. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
  12. ---
  13. ping.c | 2 +-
  14. ping.h | 2 +-
  15. 2 files changed, 2 insertions(+), 2 deletions(-)
  16. diff --git a/ping.c b/ping.c
  17. index 733477f..b241815 100644
  18. --- a/ping.c
  19. +++ b/ping.c
  20. @@ -207,9 +207,9 @@ main(int argc, char **argv)
  21. #ifdef USE_IDN
  22. setlocale(LC_ALL, "");
  23. -#endif
  24. if (!strcmp(setlocale(LC_ALL, NULL), "C"))
  25. hints.ai_flags &= ~ AI_CANONIDN;
  26. +#endif
  27. /* Support being called using `ping4` or `ping6` symlinks */
  28. if (argv[0][strlen(argv[0])-1] == '4')
  29. diff --git a/ping.h b/ping.h
  30. index 3e09685..8a0c4ef 100644
  31. --- a/ping.h
  32. +++ b/ping.h
  33. @@ -28,7 +28,6 @@
  34. #include <netinet/icmp6.h>
  35. #include <linux/filter.h>
  36. #include <resolv.h>
  37. -#include <locale.h>
  38. #ifdef CAPABILITIES
  39. #include <sys/prctl.h>
  40. @@ -36,6 +35,7 @@
  41. #endif
  42. #ifdef USE_IDN
  43. +#include <locale.h>
  44. #include <idn2.h>
  45. #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
  46. #define getnameinfo_flags NI_IDN