avl_for_each_element(&net->hosts, host, node) {
inet_ntop(AF_INET6, &host->peer.local_addr, ip, sizeof(ip));
- fprintf(f, "%s\t%s\n", ip, network_host_name(host));
+ fprintf(f, "%s\t%s%s%s\n", ip, network_host_name(host),
+ net->config.domain ? "." : "",
+ net->config.domain ? net->config.domain : "");
}
}
if (!hosts_file)
return;
- asprintf(&tmpfile, "%s.XXXXXXXX", hosts_file);
+ if (asprintf(&tmpfile, "%s.XXXXXXXX", hosts_file) < 0)
+ return;
+
fd = mkstemp(tmpfile);
if (fd < 0) {
perror("mkstemp");