Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improves how open() errors are handled at the I/O-cache layer. Thanks

a million to Stefan de Konink <stefan@konink.de> for this patch!!

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6583 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
commit 6428c5f069b45fb1be4f43146a5d14a8df667f2d 1 parent c2ab6d0
@alobbs alobbs authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 cherokee/iocache.c
View
20 cherokee/iocache.c
@@ -352,8 +352,24 @@ ioentry_update_mmap (cherokee_iocache_entry_t *entry,
if (fd_local < 0) {
fd_local = cherokee_open (filename->buf, (O_RDONLY | O_BINARY), 0);
if (unlikely (fd_local < 0)) {
- TRACE(ENTRIES, "Couldn't open(): %s\n", filename->buf);
- ret = ret_error;
+ TRACE(ENTRIES, "Couldn't open(%s) = %s\n", filename->buf, strerror(errno));
+
+ switch (errno) {
+ case EACCES:
+ ret = ret_deny;
+ break;
+ case ENOENT:
+ case ENOTDIR:
+ ret = ret_not_found;
+ break;
+ default:
+ ret = ret_error;
+ break;
+ }
+
+ PRIV(entry)->stat_expiration = cherokee_bogonow_now + iocache->lasting_stat;
+ PUBL(entry)->state_ret = ret;
+
goto error;
}
Please sign in to comment.
Something went wrong with that request. Please try again.