summaryrefslogtreecommitdiff
path: root/src/network/res_send.c
blob: 9593164db0df4f0ee095f6677e95844217812248 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <resolv.h>
#include <string.h>

int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen)
{
	int r;
	if (anslen < 512) {
		unsigned char buf[512];
		r = __res_send(msg, msglen, buf, sizeof buf);
		if (r >= 0) memcpy(answer, buf, r < anslen ? r : anslen);
		return r;
	}
	r = __res_msend(1, &msg, &msglen, &answer, &anslen, anslen);
	return r<0 || !anslen ? -1 : anslen;
}

weak_alias(__res_send, res_send);