summaryrefslogtreecommitdiff
path: root/src/stat_cache.c
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
commit478cb34bb3abb0a353cc6228f075ae5890cd28a5 (patch)
treebb243a5331789b87073854dc5fd4d1eadcc2f44c /src/stat_cache.c
parent11c3722432dd9d1f33e17a861b273c92eb5623cc (diff)
downloadlighttpd1.4-478cb34bb3abb0a353cc6228f075ae5890cd28a5.tar.gz
lighttpd1.4-478cb34bb3abb0a353cc6228f075ae5890cd28a5.zip
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
Diffstat (limited to 'src/stat_cache.c')
-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;