mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-16 21:29:20 +02:00
code cleanup
This commit is contained in:
parent
757f59e350
commit
eb082ac9ce
16
src/dns.c
16
src/dns.c
|
@ -193,22 +193,22 @@ dns_build_hostname(char *buf, size_t buflen,
|
||||||
const char *data, const size_t datalen,
|
const char *data, const size_t datalen,
|
||||||
const char *topdomain)
|
const char *topdomain)
|
||||||
{
|
{
|
||||||
|
int consumed;
|
||||||
int avail;
|
int avail;
|
||||||
int written;
|
|
||||||
int encoded;
|
|
||||||
char *b;
|
char *b;
|
||||||
|
|
||||||
avail = MIN(0xFF, buflen) - strlen(topdomain) - 2;
|
avail = MIN(0xFF, buflen) - strlen(topdomain) - 2;
|
||||||
memset(buf, 0, buflen);
|
memset(buf, 0, buflen);
|
||||||
b = buf;
|
b = buf;
|
||||||
written = encode_data(data, datalen, avail, b);
|
|
||||||
encoded = strlen(buf);
|
consumed = encode_data(data, datalen, avail, b);
|
||||||
b += encoded;
|
|
||||||
if (*b != '.') {
|
b += strlen(buf);
|
||||||
|
if (*b != '.')
|
||||||
*b++ = '.';
|
*b++ = '.';
|
||||||
}
|
|
||||||
strncpy(b, topdomain, strlen(topdomain)+1);
|
strncpy(b, topdomain, strlen(topdomain)+1);
|
||||||
|
|
||||||
return written;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue