summaryrefslogtreecommitdiff
path: root/src/stat_cache.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-06-07 19:07:31 +0000
committerStefan Bühler <stbuehler@web.de>2009-06-07 19:07:31 +0000
commit57066345e4b50313b20a4b3e9ac94f1b0fb0f979 (patch)
tree0c1906b5249a777fd84c34385d5a246f4b5a8886 /src/stat_cache.c
parentb063f0186a526faebb7e1743382ce097ac168a87 (diff)
downloadlighttpd1.4-57066345e4b50313b20a4b3e9ac94f1b0fb0f979.tar.gz
lighttpd1.4-57066345e4b50313b20a4b3e9ac94f1b0fb0f979.zip
Workaround broken operating systems: check for trailing '/' in filenames (fixes #1989)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2510 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/stat_cache.c')
-rw-r--r--src/stat_cache.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stat_cache.c b/src/stat_cache.c
index 15410760..26571437 100644
--- a/src/stat_cache.c
+++ b/src/stat_cache.c
@@ -489,6 +489,12 @@ handler_t stat_cache_get_entry(server *srv, connection *con, buffer *name, stat_
if (S_ISREG(st.st_mode)) {
+ /* fix broken stat/open for symlinks to reg files with appended slash on freebsd,osx */
+ if (name->ptr[name->used-2] == '/') {
+ errno = ENOTDIR;
+ return HANDLER_ERROR;
+ }
+
/* try to open the file to check if we can read it */
if (-1 == (fd = open(name->ptr, O_RDONLY))) {
return HANDLER_ERROR;