for EAGAIN: don't close the fd twice, for the other errno's: close() might modify errno.

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@634 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.2
Jan Kneschke 18 years ago
parent 1f00903dd2
commit e19d4d77db

@ -166,15 +166,15 @@ int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, chunk
/* FreeBSD sendfile() */
if (-1 == sendfile(ifd, fd, offset, toSend, NULL, &r, 0)) {
close(ifd);
switch(errno) {
case EAGAIN:
break;
case ENOTCONN:
close(ifd);
return -2;
default:
log_error_write(srv, __FILE__, __LINE__, "ssd", "sendfile: ", strerror(errno), errno);
close(ifd);
return -1;
}
}

Loading…
Cancel
Save