summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-11-22 14:29:55 +0000
committerJan Kneschke <jan@kneschke.de>2005-11-22 14:29:55 +0000
commitbda188266e710a01ac6a28f758903c9a2852dd97 (patch)
treebb243a5331789b87073854dc5fd4d1eadcc2f44c /src
parent271a35a5a474e45f8ffb2482ccaf3f9c14203eb5 (diff)
downloadlighttpd-git-bda188266e710a01ac6a28f758903c9a2852dd97.tar.gz
reverted last patch as open + fstat() results in a hang on named-pipes
git-svn-id: svn+ssh://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@875 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src')
-rw-r--r--src/stat_cache.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/stat_cache.c b/src/stat_cache.c
index f12202e2..148f4c83 100644
--- a/src/stat_cache.c
+++ b/src/stat_cache.c
@@ -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;