[or-cvs] clean dns.c better
Roger Dingledine
arma at seul.org
Wed Apr 28 20:11:39 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
dns.c routerlist.c
Log Message:
clean dns.c better
Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- dns.c 28 Apr 2004 19:55:20 -0000 1.80
+++ dns.c 28 Apr 2004 20:11:37 -0000 1.81
@@ -451,6 +451,7 @@
char address[MAX_ADDRESSLEN];
unsigned char address_len;
char answer[5];
+ uint32_t ip;
int *fdarray = data;
int fd;
@@ -475,7 +476,7 @@
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 @@
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();
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- routerlist.c 28 Apr 2004 19:35:12 -0000 1.66
+++ routerlist.c 28 Apr 2004 20:11:37 -0000 1.67
@@ -505,9 +505,7 @@
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;
More information about the tor-commits
mailing list