You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1996/04/02 14:58:05 UTC

Re: SIGPIPE and timeout on Solaris (solved apparently)

> > 
> > 
> > I made the following change to http_protocol.c and it seems to
> > have fixed the problem. Could someone give me a one liner on
> > how to commit this, and give me commit permissions?
> 
> This patch is wrong. It is not correct to check errno unless you have already
> seen an error return. I would suggest a simple "if(w <= 0) break;" instead.
> Of course, the following code should deal with the matter appropriately, too.

How about the following. None of the other patches I have seen
for this piece of code will actually break the loop if the
write actually fails. The formating is strange since formating
in the rest of the routine is different than my Emacs want's it
to be. 

*** http_protocol.c.orig	Tue Apr  2 06:48:41 1996
--- http_protocol.c	Tue Apr  2 06:53:50 1996
***************
*** 718,730 ****
          o=0;
  	total_bytes_sent += n;
  	
!         while(n && !r->connection->aborted) {
!             w=bwrite(c->client, &buf[o], n);
! 	    if (w)
! 	        reset_timeout(r); /* reset timeout after successfule write */
!             n-=w;
!             o+=w;
!         }
      }
      bflush(c->client);
      
--- 718,733 ----
          o=0;
  	total_bytes_sent += n;
  	
! 	while(n && !r->connection->aborted) {
! 	    w=bwrite(c->client, &buf[o], n);
! 	    if (w > 0) {
! 		reset_timeout(r); /* reset timeout after successfule write */
! 		n-=w;
! 		o+=w;
! 	    }
! 	    else
! 		break;
! 	}
      }
      bflush(c->client);