1
0

002-fix-res_send-on-uclibc.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. --- a/configure.ac
  2. +++ b/configure.ac
  3. @@ -161,6 +161,10 @@ if test "x$found_resolv" != "xyes"; then
  4. AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
  5. fi
  6. LIBS="${LIBS} ${RESOLV_LIBS}"
  7. +AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
  8. +AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
  9. +AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
  10. +AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
  11. dnl *****************************************************************
  12. dnl * *
  13. --- a/src/libs/zbxsysinfo/common/net.c
  14. +++ b/src/libs/zbxsysinfo/common/net.c
  15. @@ -471,6 +471,7 @@ static int dns_query(AGENT_REQUEST *requ
  16. return SYSINFO_RET_FAIL;
  17. }
  18. +#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND)
  19. if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
  20. {
  21. SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno)));
  22. @@ -505,6 +506,11 @@ static int dns_query(AGENT_REQUEST *requ
  23. _res.retry = retry;
  24. res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
  25. +#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */
  26. + /* retrand and retry are ignored */
  27. + if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer))))
  28. + return SYSINFO_RET_FAIL;
  29. +#endif
  30. _res.options = saved_options;
  31. _res.retrans = saved_retrans;