[or-cvs] Make errors retrievable from tor_socketpair; resolve bug 163.

Nick Mathewson nickm at seul.org
Thu Jun 30 07:17:40 UTC 2005


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

Modified Files:
	connection_edge.c cpuworker.c dns.c 
Log Message:
Make errors retrievable from tor_socketpair; resolve bug 163.

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -d -r1.334 -r1.335
--- connection_edge.c	29 Jun 2005 21:46:55 -0000	1.334
+++ connection_edge.c	30 Jun 2005 07:17:38 -0000	1.335
@@ -1207,12 +1207,13 @@
 {
   int fd[2];
   connection_t *conn;
+  int err;
 
   log_fn(LOG_INFO,"Making AP bridge to %s:%d ...",safe_str(address),port);
 
-  if (tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
+  if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) < 0) {
     log(LOG_WARN,"Couldn't construct socketpair (%s). Network down? Delaying.",
-        tor_socket_strerror(tor_socket_errno(-1)));
+        tor_socket_strerror(-err));
     return -1;
   }
 

Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- cpuworker.c	11 Jun 2005 18:52:11 -0000	1.83
+++ cpuworker.c	30 Jun 2005 07:17:38 -0000	1.84
@@ -301,11 +301,11 @@
   int *fdarray;
   int fd;
   connection_t *conn;
+  int err;
 
   fdarray = tor_malloc(sizeof(int)*2);
-  if (tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray) < 0) {
-    log(LOG_ERR, "Couldn't construct socketpair: %s",
-        tor_socket_strerror(tor_socket_errno(-1)));
+  if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
+    log(LOG_ERR, "Couldn't construct socketpair: %s", tor_socket_strerror(-err));
     tor_cleanup();
     tor_free(fdarray);
     exit(1);

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- dns.c	28 Jun 2005 01:53:15 -0000	1.160
+++ dns.c	30 Jun 2005 07:17:38 -0000	1.161
@@ -824,11 +824,11 @@
   int *fdarray;
   int fd;
   connection_t *conn;
+  int err;
 
   fdarray = tor_malloc(sizeof(int)*2);
-  if (tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray) < 0) {
-    log(LOG_ERR, "Couldn't construct socketpair: %s",
-        tor_socket_strerror(tor_socket_errno(-1)));
+  if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
+    log(LOG_ERR, "Couldn't construct socketpair: %s", tor_socket_strerror(-err));
     tor_cleanup();
     tor_free(fdarray);
     exit(1);



More information about the tor-commits mailing list