Fix error handling in freebsd-sendfile (fixes #1813)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2389 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.21
Stefan Bühler 15 years ago
parent 705fcaaff1
commit 9960b1a3ed

@ -34,6 +34,7 @@ NEWS
* Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)
* Use modified etags in mod_compress (fixes #1800)
* Fix max-connection limit handling/100% cpu usage (fixes #1436)
* Fix error handling in freebsd-sendfile (fixes #1813)
- 1.4.20 - 2008-09-30

@ -167,6 +167,7 @@ int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int f
switch(errno) {
case EAGAIN:
case EINTR:
r = 0; /* try again later */
break;
case ENOTCONN:
return -2;
@ -174,10 +175,7 @@ int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int f
log_error_write(srv, __FILE__, __LINE__, "ssd", "sendfile: ", strerror(errno), errno);
return -1;
}
}
if (r == 0 && (errno != EAGAIN && errno != EINTR)) {
int oerrno = errno;
} else if (r == 0) {
/* We got an event to write but we wrote nothing
*
* - the file shrinked -> error
@ -190,12 +188,9 @@ int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int f
if (offset >= sce->st.st_size) {
/* file shrinked, close the connection */
errno = oerrno;
return -1;
}
errno = oerrno;
return -2;
}

Loading…
Cancel
Save