[or-cvs] Working strerror for windows socket errors, plus some snide...

Nick Mathewson nickm at seul.org
Sun May 2 20:18:24 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv18306/src/or

Modified Files:
	connection.c connection_edge.c cpuworker.c dns.c main.c 
Log Message:
Working strerror for windows socket errors, plus some snide comments.

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -d -r1.209 -r1.210
--- connection.c	2 May 2004 03:15:55 -0000	1.209
+++ connection.c	2 May 2004 20:18:21 -0000	1.210
@@ -279,13 +279,13 @@
 
   if(bind(s,(struct sockaddr *)&bindaddr,sizeof(bindaddr)) < 0) {
     log_fn(LOG_WARN,"Could not bind to port %u: %s",bindport,
-           strerror(tor_socket_errno(s)));
+           tor_socket_strerror(tor_socket_errno(s)));
     return -1;
   }
 
   if(listen(s,SOMAXCONN) < 0) {
     log_fn(LOG_WARN,"Could not listen on port %u: %s",bindport,
-           strerror(tor_socket_errno(s)));
+           tor_socket_strerror(tor_socket_errno(s)));
     return -1;
   }
 
@@ -392,7 +392,7 @@
     if(!ERRNO_IS_CONN_EINPROGRESS(tor_socket_errno(s))) {
       /* yuck. kill it. */
       log_fn(LOG_INFO,"Connect() to %s:%u failed: %s",address,port,
-             strerror(tor_socket_errno(s)));
+             tor_socket_strerror(tor_socket_errno(s)));
       tor_close_socket(s);
       return -1;
     } else {

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- connection_edge.c	1 May 2004 20:46:28 -0000	1.181
+++ connection_edge.c	2 May 2004 20:18:21 -0000	1.182
@@ -1067,7 +1067,8 @@
   log_fn(LOG_INFO,"Making AP bridge to %s:%d ...",address,port);
 
   if(tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
-    log(LOG_WARN, "Couldn't construct socketpair (%s). Network down? Delaying.", strerror(errno));
+    log(LOG_WARN,"Couldn't construct socketpair (%s). Network down? Delaying.",
+        tor_socket_strerror(tor_socket_errno(-1)));
     return -1;
   }
 

Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cpuworker.c	28 Apr 2004 21:14:56 -0000	1.32
+++ cpuworker.c	2 May 2004 20:18:21 -0000	1.33
@@ -214,7 +214,8 @@
   connection_t *conn;
 
   if(tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
-    log(LOG_ERR, "Couldn't construct socketpair: %s", strerror(errno));
+    log(LOG_ERR, "Couldn't construct socketpair: %s",
+        tor_socket_strerror(tor_socket_errno(-1)));
     exit(1);
   }
 

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- dns.c	28 Apr 2004 21:14:56 -0000	1.83
+++ dns.c	2 May 2004 20:18:21 -0000	1.84
@@ -503,7 +503,8 @@
   connection_t *conn;
 
   if(tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
-    log(LOG_ERR, "Couldn't construct socketpair: %s", strerror(errno));
+    log(LOG_ERR, "Couldn't construct socketpair: %s",
+        tor_socket_strerror(tor_socket_errno(-1)));
     exit(1);
   }
 

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -d -r1.252 -r1.253
--- main.c	1 May 2004 20:46:28 -0000	1.252
+++ main.c	2 May 2004 20:18:21 -0000	1.253
@@ -656,7 +656,8 @@
       /* let the program survive things like ^z */
       if(tor_socket_errno(-1) != EINTR) {
         log_fn(LOG_ERR,"poll failed: %s [%d]",
-               strerror(tor_socket_errno(-1)), tor_socket_errno(-1));
+               tor_socket_strerror(tor_socket_errno(-1)),
+               tor_socket_errno(-1));
         return -1;
       } else {
         log_fn(LOG_DEBUG,"poll interrupted.");



More information about the tor-commits mailing list