mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 13:06:06 +03: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 *topdomain)
|
||||
{
|
||||
int consumed;
|
||||
int avail;
|
||||
int written;
|
||||
int encoded;
|
||||
char *b;
|
||||
|
||||
avail = MIN(0xFF, buflen) - strlen(topdomain) - 2;
|
||||
memset(buf, 0, buflen);
|
||||
b = buf;
|
||||
written = encode_data(data, datalen, avail, b);
|
||||
encoded = strlen(buf);
|
||||
b += encoded;
|
||||
if (*b != '.') {
|
||||
|
||||
consumed = encode_data(data, datalen, avail, b);
|
||||
|
||||
b += strlen(buf);
|
||||
if (*b != '.')
|
||||
*b++ = '.';
|
||||
}
|
||||
|
||||
strncpy(b, topdomain, strlen(topdomain)+1);
|
||||
|
||||
return written;
|
||||
return consumed;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user