summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2009-10-16 09:02:58 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2009-10-16 09:02:58 +0000
commit32b16b0ff422aadef88090e2686650c3f1b80ba0 (patch)
treefc16560650ce881e54c90b52c9df932f6686ae7f
parent20eab04d57337075f6d7b03b184c68a88ff3576c (diff)
downloadlighttpd-32b16b0ff422aadef88090e2686650c3f1b80ba0.tar.gz
stat-cache: verify that entries are still fresh
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@2658 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--src/stat_cache.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/stat_cache.c b/src/stat_cache.c
index 276c8ac8..6b605e82 100644
--- a/src/stat_cache.c
+++ b/src/stat_cache.c
@@ -270,8 +270,22 @@ static int stat_cache_lstat(server *srv, buffer *dname, struct stat *lst) {
#endif
static int stat_cache_entry_is_current(server *srv, stat_cache_entry *sce) {
+ struct stat st;
UNUSED(srv);
UNUSED(sce);
+
+ if (-1 == stat(sce->name->ptr, &st)) {
+ return 0;
+ }
+ /* still existing */
+
+ if (st.st_dev != sce->st.st_dev || st.st_ino != sce->st.st_ino) {
+ return 0; /* different file */
+ }
+
+ /* same file, still existing: update other stats: */
+ sce->st = st;
+ /* need to check other properties before this: sce->stat_ts = srv->cur_ts; */
return 1;
}