mirror of https://github.com/SChernykh/p2pool
Fixed headers for res_query
parent
be8b38e5cf
commit
bba4f8d0c5
|
@ -204,6 +204,8 @@ include(CheckCSourceCompiles)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES "resolv")
|
set(CMAKE_REQUIRED_LIBRARIES "resolv")
|
||||||
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
#include <resolv.h>
|
#include <resolv.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -235,6 +237,10 @@ int main(int argc, char* argv[])
|
||||||
int len = ns_rr_rdlen(rr) - 1;
|
int len = ns_rr_rdlen(rr) - 1;
|
||||||
if (len > data[0]) len = data[0];
|
if (len > data[0]) len = data[0];
|
||||||
|
|
||||||
|
if (len <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
memcpy(buf, data + 1, len);
|
memcpy(buf, data + 1, len);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <WinDNS.h>
|
#include <WinDNS.h>
|
||||||
#elif defined(HAVE_RES_QUERY)
|
#elif defined(HAVE_RES_QUERY)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
#include <resolv.h>
|
#include <resolv.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -528,6 +530,9 @@ void P2PServer::load_peer_list()
|
||||||
const uint8_t* data = ns_rr_rdata(rr);
|
const uint8_t* data = ns_rr_rdata(rr);
|
||||||
|
|
||||||
const int len = std::min<int>(ns_rr_rdlen(rr) - 1, *data);
|
const int len = std::min<int>(ns_rr_rdlen(rr) - 1, *data);
|
||||||
|
if (len <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
++data;
|
++data;
|
||||||
|
|
||||||
if (!saved_list.empty()) {
|
if (!saved_list.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue