reverted last patch as open + fstat() results in a hang on named-pipes

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@875 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.8
Jan Kneschke 2005-11-22 14:29:55 +00:00
parent 11c3722432
commit 478cb34bb3
1 changed files with 15 additions and 6 deletions

View File

@ -446,18 +446,27 @@ handler_t stat_cache_get_entry(server *srv, connection *con, buffer *name, stat_
}
}
#endif
/* try to open the file */
if (-1 == (fd = open(name->ptr, O_RDONLY))) {
/*
* *lol*
* - open() + fstat() on a named-pipe results in a (intended) hang.
* - stat() if regualar file + open() to see if we can read from it is better
*
* */
if (-1 == stat(name->ptr, &st)) {
return HANDLER_ERROR;
}
if (-1 == fstat(fd, &st)) {
if (S_ISREG(st.st_mode)) {
/* try to open the file to check if we can read it */
if (-1 == (fd = open(name->ptr, O_RDONLY))) {
return HANDLER_ERROR;
}
close(fd);
return HANDLER_ERROR;
}
close(fd);
if (NULL == sce) {
int osize = 0;