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.

46 lines
1.2 KiB

  1. diff -urNp a/lib/nicInfo/nicInfoPosix.c b/lib/nicInfo/nicInfoPosix.c
  2. --- a/lib/nicInfo/nicInfoPosix.c
  3. +++ b/lib/nicInfo/nicInfoPosix.c
  4. @@ -65,6 +65,9 @@
  5. #include <netinet/in.h>
  6. #include <arpa/nameser.h>
  7. #include <resolv.h>
  8. +#if defined(__linux__) && !defined(__GLIBC__)
  9. +#include "resolv_compat.h"
  10. +#endif
  11. #ifdef __linux__
  12. # include <net/if.h>
  13. diff -urNp a/lib/nicInfo/resolv_compat.h b/lib/nicInfo/resolv_compat.h
  14. --- a/lib/nicInfo/resolv_compat.h
  15. +++ b/lib/nicInfo/resolv_compat.h
  16. @@ -0,0 +1,29 @@
  17. +#if !defined(__GLIBC__)
  18. +/***************************************************************************
  19. + * resolv_compat.h
  20. + *
  21. + * Mimick GLIBC's res_ninit() and res_nclose() for musl libc
  22. + * Note: res_init() is actually deprecated according to
  23. + * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html
  24. + **************************************************************************/
  25. +#include <string.h>
  26. +
  27. +static inline int res_ninit(res_state statp)
  28. +{
  29. + int rc = res_init();
  30. + if (statp != &_res) {
  31. + memcpy(statp, &_res, sizeof(*statp));
  32. + }
  33. + return rc;
  34. +}
  35. +
  36. +static inline int res_nclose(res_state statp)
  37. +{
  38. + if (!statp)
  39. + return -1;
  40. + if (statp != &_res) {
  41. + memset(statp, 0, sizeof(*statp));
  42. + }
  43. + return 0;
  44. +}
  45. +#endif