[or-cvs] fix problems noticed by arma in rendservice.c

Nick Mathewson nickm at seul.org
Thu Jul 14 16:41:49 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv30057/src/or

Modified Files:
	rendservice.c 
Log Message:
fix problems noticed by arma in rendservice.c

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- rendservice.c	14 Jul 2005 08:45:19 -0000	1.128
+++ rendservice.c	14 Jul 2005 16:41:47 -0000	1.129
@@ -592,8 +592,8 @@
       oldcirc->build_state->failure_count > MAX_REND_FAILURES ||
       oldcirc->build_state->expiry_time < time(NULL)) {
     log_fn(LOG_INFO,"Attempt to build circuit to %s for rendezvous has failed too many times or expired; giving up.",
-           oldcirc->build_state->chosen_exit->nickname);
-    /* XXX bug: if the first clause of the if triggers, we'll seg fault. */
+           oldcirc->build_state ? oldcirc->build_state->chosen_exit->nickname :
+           "*unknown*");
     return;
   }
 
@@ -831,9 +831,8 @@
   while ((circ = circuit_get_next_by_pk_and_purpose(circ,pk_digest,
                                                   CIRCUIT_PURPOSE_S_INTRO))) {
     tor_assert(circ->cpath);
-    /* XXX this is a bug. ->nickname will always be there. */
-    if (circ->build_state->chosen_exit->nickname &&
-        !strcasecmp(circ->build_state->chosen_exit->nickname, router->nickname)) {
+    if (!strcasecmp(circ->build_state->chosen_exit->nickname,
+                    router->nickname)) {
       return circ;
     }
   }
@@ -842,9 +841,8 @@
   while ((circ = circuit_get_next_by_pk_and_purpose(circ,pk_digest,
                                         CIRCUIT_PURPOSE_S_ESTABLISH_INTRO))) {
     tor_assert(circ->cpath);
-    /* XXX this is a bug. ->nickname will always be there. */
-    if (circ->build_state->chosen_exit->nickname &&
-        !strcasecmp(circ->build_state->chosen_exit->nickname, router->nickname)) {
+    if (!strcasecmp(circ->build_state->chosen_exit->nickname,
+                    router->nickname)) {
       return circ;
     }
   }



More information about the tor-commits mailing list