[or-cvs] when we fail to bind a listener, try to provide a more usef...

arma at seul.org arma at seul.org
Fri Feb 3 12:26:12 UTC 2006


Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	connection.c 
Log Message:
when we fail to bind a listener, try to provide a more useful log msg.


Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.434
retrieving revision 1.435
diff -u -p -d -r1.434 -r1.435
--- connection.c	17 Jan 2006 04:16:59 -0000	1.434
+++ connection.c	3 Feb 2006 12:26:10 -0000	1.435
@@ -547,8 +547,12 @@ connection_create_listener(const char *l
 #endif
 
   if (bind(s,(struct sockaddr *)&listenaddr,sizeof(listenaddr)) < 0) {
-    warn(LD_NET, "Could not bind to %s:%u: %s", address, usePort,
-         tor_socket_strerror(tor_socket_errno(s)));
+    char *helpfulhint = "";
+    int e = tor_socket_errno(s);
+    if (ERRNO_IS_EADDRINUSE(e))
+      helpfulhint = ". Is Tor already running?";
+    warn(LD_NET, "Could not bind to %s:%u: %s%s", address, usePort,
+         tor_socket_strerror(e), helpfulhint);
     goto err;
   }
 



More information about the tor-commits mailing list