[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] avoid infinite loop in tor-resolve if tor hangs up on it



Update of /home2/or/cvsroot/tor/src/tools
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/tools

Modified Files:
	tor-resolve.c 
Log Message:
avoid infinite loop in tor-resolve if tor hangs up on it


Index: tor-resolve.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/tools/tor-resolve.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- tor-resolve.c	14 Nov 2004 18:14:15 -0000	1.6
+++ tor-resolve.c	24 Nov 2004 07:45:42 -0000	1.7
@@ -137,6 +137,10 @@
   len = 0;
   while (len < RESPONSE_LEN) {
     r = recv(s, response_buf+len, RESPONSE_LEN-len, 0);
+    if (r==0) {
+      log_fn(LOG_WARN,"EOF while reading SOCKS response");
+      return -1;
+    }
     if (r<0) {
       log_sock_error("reading SOCKS response", s);
       return -1;