Skip to content

Commit

Permalink
Fixes a few corner cases on Front-Line Cache.
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/cherokee/trunk@6609 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed May 10, 2011
1 parent 516651e commit 0e40230
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cherokee/error_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@
desc = CODING_BUG)

e('UTIL_MKDIR',
title = "Could not mkdir '%s': ${errno}",
title = "Could not mkdir '%s' (UID %d): ${errno}",
desc = "Most probably there you have to adjust some permissions.")


Expand Down
5 changes: 3 additions & 2 deletions cherokee/flcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ cherokee_flcache_configure (cherokee_flcache_t *flcache,
cherokee_buffer_add_str (&flcache->local_directory, CHEROKEE_FLCACHE "/");
cherokee_buffer_add_buffer (&flcache->local_directory, &vserver->name);

ret = cherokee_mkdir_p_perm (&flcache->local_directory, 0700, W_OK);
ret = cherokee_mkdir_p_perm (&flcache->local_directory, 0755, W_OK);
if (ret != ret_ok) {
LOG_CRITICAL (CHEROKEE_ERROR_FLCACHE_MKDIR, flcache->local_directory.buf, "write");
return ret;
Expand Down Expand Up @@ -487,7 +487,7 @@ create_flconn_file (cherokee_flcache_t *flcache,

cherokee_buffer_add (&tmp, entry->file.buf, p - entry->file.buf);

ret = cherokee_mkdir_p_perm (&tmp, 0700, W_OK);
ret = cherokee_mkdir_p_perm (&tmp, 0755, W_OK);
if (ret != ret_ok) {
LOG_CRITICAL (CHEROKEE_ERROR_FLCACHE_MKDIR, tmp.buf, "write");
goto error;
Expand Down Expand Up @@ -545,6 +545,7 @@ cherokee_flcache_conn_commit_header (cherokee_flcache_conn_t *flcache_conn,
*/
ret = create_flconn_file (CONN_VSRV(conn)->flcache, conn);
if (ret != ret_ok) {
cherokee_flcache_del_entry (CONN_VSRV(conn)->flcache, entry);
return ret_error;
}

Expand Down
3 changes: 2 additions & 1 deletion cherokee/flcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ typedef struct cherokee_flcache_conn cherokee_flcache_conn_t;
typedef enum {
flcache_mdoe_undef,
flcache_mode_in,
flcache_mode_out
flcache_mode_out,
flcache_mode_error
} cherokee_flcache_mode_t;

typedef enum {
Expand Down
3 changes: 2 additions & 1 deletion cherokee/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,8 @@ process_active_connections (cherokee_thread_t *thd)
if (conn->flcache.mode == flcache_mode_in) {
ret = cherokee_flcache_conn_commit_header (&conn->flcache, conn);
if (ret != ret_ok) {
/* Flcache has been disabled */
/* Disabled Front-Line Cache */
conn->flcache.mode = flcache_mode_error;
}
}

Expand Down
9 changes: 7 additions & 2 deletions cherokee/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,7 @@ cherokee_mkdir_p (cherokee_buffer_t *path, int mode)
{
int re;
char *p;
int err;
struct stat foo;

/* There is no directory
Expand Down Expand Up @@ -1832,8 +1833,10 @@ cherokee_mkdir_p (cherokee_buffer_t *path, int mode)
if (re != 0) {
re = cherokee_mkdir (path->buf, mode);
if ((re != 0) && (errno != EEXIST)) {
err = errno;
*p = '/';
LOG_ERRNO (errno, cherokee_err_error, CHEROKEE_ERROR_UTIL_MKDIR, path->buf);

LOG_ERRNO (err, cherokee_err_error, CHEROKEE_ERROR_UTIL_MKDIR, path->buf, getuid());
return ret_error;
}
}
Expand All @@ -1847,7 +1850,9 @@ cherokee_mkdir_p (cherokee_buffer_t *path, int mode)

re = cherokee_mkdir (path->buf, mode);
if ((re != 0) && (errno != EEXIST)) {
LOG_ERRNO (errno, cherokee_err_error, CHEROKEE_ERROR_UTIL_MKDIR, path->buf);
err = errno;

LOG_ERRNO (err, cherokee_err_error, CHEROKEE_ERROR_UTIL_MKDIR, path->buf, getuid());
return ret_error;
}

Expand Down

0 comments on commit 0e40230

Please sign in to comment.