[or-cvs] start tracking the "broken pipe" error

Roger Dingledine arma at seul.org
Thu Mar 11 20:15:55 UTC 2004


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

Modified Files:
	buffers.c main.c 
Log Message:
start tracking the 'broken pipe' error


Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- buffers.c	11 Mar 2004 06:22:53 -0000	1.71
+++ buffers.c	11 Mar 2004 20:15:53 -0000	1.72
@@ -253,6 +253,7 @@
   write_result = send(s, buf->mem, *buf_flushlen, 0);
   if (write_result < 0) {
     if(!ERRNO_EAGAIN(errno)) { /* it's a real error */
+      assert(errno != EPIPE); /* get a stack trace to find epipe bugs */
       return -1;
     }
 #ifdef MS_WINDOWS

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- main.c	11 Mar 2004 06:22:53 -0000	1.198
+++ main.c	11 Mar 2004 20:15:53 -0000	1.199
@@ -631,6 +631,9 @@
       if(options.PidFile)
         unlink(options.PidFile);
       exit(0);
+    case SIGPIPE:
+      log(LOG_WARN,"Bug: caught sigpipe. Ignoring.");
+      break;
     case SIGHUP:
       please_reset = 1;
       break;
@@ -751,6 +754,7 @@
 #ifndef MS_WINDOWS /* do signal stuff only on unix */
   signal (SIGINT,  catch); /* catch kills so we can exit cleanly */
   signal (SIGTERM, catch);
+  signal (SIGPIPE, catch);
   signal (SIGUSR1, catch); /* to dump stats */
   signal (SIGHUP,  catch); /* to reload directory */
   signal (SIGCHLD, catch); /* for exiting dns/cpu workers */



More information about the tor-commits mailing list