clean dns.c better

svn:r1737
This commit is contained in:
Roger Dingledine
2004-04-28 20:11:37 +00:00
parent fd0d48e484
commit 22c0cd8a14
2 changed files with 4 additions and 4 deletions
+3 -1
View File
@@ -451,6 +451,7 @@ int dnsworker_main(void *data) {
char address[MAX_ADDRESSLEN];
unsigned char address_len;
char answer[5];
uint32_t ip;
int *fdarray = data;
int fd;
@@ -475,7 +476,7 @@ int dnsworker_main(void *data) {
address[address_len] = 0; /* null terminate it */
/* XXX isn't this non-aligned uint32 going to cause problems? */
switch (tor_lookup_hostname(address, (uint32_t*)answer+1)) {
switch (tor_lookup_hostname(address, &ip)) {
case 1:
log_fn(LOG_INFO,"Could not resolve dest addr %s (transient).",address);
answer[0] = DNS_RESOLVE_FAILED_TRANSIENT;
@@ -489,6 +490,7 @@ int dnsworker_main(void *data) {
answer[0] = DNS_RESOLVE_SUCCEEDED;
break;
}
set_uint32(answer+1, ip);
if(write_all(fd, answer, 5, 1) != 5) {
log_fn(LOG_ERR,"writing answer failed. Child exiting.");
spawn_exit();
+1 -3
View File
@@ -505,9 +505,7 @@ int router_set_routerlist_from_directory(const char *s, crypto_pk_env_t *pkey)
static int
router_resolve(routerinfo_t *router)
{
struct hostent *rent;
if (tor_lookup_hostname(router->address, &router->addr)) {
if (tor_lookup_hostname(router->address, &router->addr) != 0) {
log_fn(LOG_WARN,"Could not get address for router %s (%s).",
router->address, router->nickname);
return -1;