[mod_flv] don't retry close(fd) on EINTR

Sources:
- http://www.daemonology.net/blog/2011-12-17-POSIX-close-is-broken.html
- http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-09/3000.html
- http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-09/3202.html

However this might not be true for all systems, more investigation needed.
personal/stbuehler/wip
Thomas Porzelt 12 years ago
parent b15ec2ecf4
commit 8a4565a63a

@ -70,16 +70,11 @@ static liHandlerResult flv(liVRequest *vr, gpointer param, gpointer *context) {
if (res == LI_HANDLER_ERROR) {
/* open or fstat failed */
if (fd != -1) {
while(-1 == close(fd)) {
if (errno != EINTR)
break;
}
}
if (fd != -1)
close(fd);
if (!li_vrequest_handle_direct(vr)) {
if (!li_vrequest_handle_direct(vr))
return LI_HANDLER_ERROR;
}
switch (err) {
case ENOENT:
@ -94,25 +89,16 @@ static liHandlerResult flv(liVRequest *vr, gpointer param, gpointer *context) {
return LI_HANDLER_ERROR;
}
} else if (S_ISDIR(st.st_mode)) {
if (fd != -1) {
while(-1 == close(fd)) {
if (errno != EINTR)
break;
}
}
if (fd != -1)
close(fd);
return LI_HANDLER_GO_ON;
} else if (!S_ISREG(st.st_mode)) {
if (fd != -1) {
while(-1 == close(fd)) {
if (errno != EINTR)
break;
}
}
if (fd != -1)
close(fd);
if (!li_vrequest_handle_direct(vr)) {
if (!li_vrequest_handle_direct(vr))
return LI_HANDLER_ERROR;
}
vr->response.http_status = 403;
} else {
@ -123,10 +109,8 @@ static liHandlerResult flv(liVRequest *vr, gpointer param, gpointer *context) {
#endif
if (!li_vrequest_handle_direct(vr)) {
while(-1 == close(fd)) {
if (errno != EINTR)
break;
}
close(fd);
return LI_HANDLER_ERROR;
}
@ -147,10 +131,7 @@ static liHandlerResult flv(liVRequest *vr, gpointer param, gpointer *context) {
li_etag_set_header(vr, &st, &cachable);
if (cachable) {
vr->response.http_status = 304;
while(-1 == close(fd)) {
if (errno != EINTR)
break;
}
close(fd);
return LI_HANDLER_GO_ON;
}

Loading…
Cancel
Save