Commit f23826a7 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Paranoia.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1728 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 2947f6aa
...@@ -46,7 +46,7 @@ static void ...@@ -46,7 +46,7 @@ static void
rdf(struct pollfd *fds, int idx) rdf(struct pollfd *fds, int idx)
{ {
int i, j; int i, j;
char buf[BUFSIZ]; char buf[BUFSIZ], *p;
i = read(fds[idx].fd, buf, sizeof buf); i = read(fds[idx].fd, buf, sizeof buf);
if (i <= 0 || fds[1-idx].events == 0) { if (i <= 0 || fds[1-idx].events == 0) {
...@@ -55,14 +55,17 @@ rdf(struct pollfd *fds, int idx) ...@@ -55,14 +55,17 @@ rdf(struct pollfd *fds, int idx)
shutdown(fds[idx].fd, SHUT_RD); shutdown(fds[idx].fd, SHUT_RD);
shutdown(fds[1-idx].fd, SHUT_WR); shutdown(fds[1-idx].fd, SHUT_WR);
fds[idx].events = 0; fds[idx].events = 0;
} else { return;
j = write(fds[1-idx].fd, buf, i); }
if (i != j) { for (p = buf; i > 0; i -= j, p += j) {
j = write(fds[1-idx].fd, p, i);
if (j < 0) {
VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)"); VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)");
VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)"); VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)");
shutdown(fds[idx].fd, SHUT_WR); shutdown(fds[idx].fd, SHUT_WR);
shutdown(fds[1-idx].fd, SHUT_RD); shutdown(fds[1-idx].fd, SHUT_RD);
fds[1-idx].events = 0; fds[1-idx].events = 0;
return;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment