dovecot-2.0: lib-index: Fixed logging file creation EACCES failu...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Feb 9 20:07:54 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/442c980d6221
changeset: 10686:442c980d6221
user: Timo Sirainen <tss at iki.fi>
date: Tue Feb 09 20:07:49 2010 +0200
description:
lib-index: Fixed logging file creation EACCES failures.
diffstat:
2 files changed, 15 insertions(+), 16 deletions(-)
src/lib-index/mail-cache.c | 14 ++------------
src/lib-index/mail-index.c | 17 +++++++++++++----
diffs (65 lines):
diff -r 3609c8a35c36 -r 442c980d6221 src/lib-index/mail-cache.c
--- a/src/lib-index/mail-cache.c Tue Feb 09 19:50:17 2010 +0200
+++ b/src/lib-index/mail-cache.c Tue Feb 09 20:07:49 2010 +0200
@@ -15,18 +15,8 @@ void mail_cache_set_syscall_error(struct
void mail_cache_set_syscall_error(struct mail_cache *cache,
const char *function)
{
- i_assert(function != NULL);
-
- if (ENOSPACE(errno)) {
- cache->index->nodiskspace = TRUE;
- if ((cache->index->flags &
- MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY) == 0)
- return;
- }
-
- mail_index_set_error(cache->index,
- "%s failed with index cache file %s: %m",
- function, cache->filepath);
+ mail_index_file_set_syscall_error(cache->index, cache->filepath,
+ function);
}
static void mail_cache_unlink(struct mail_cache *cache)
diff -r 3609c8a35c36 -r 442c980d6221 src/lib-index/mail-index.c
--- a/src/lib-index/mail-index.c Tue Feb 09 19:50:17 2010 +0200
+++ b/src/lib-index/mail-index.c Tue Feb 09 20:07:49 2010 +0200
@@ -413,8 +413,10 @@ int mail_index_create_tmp_file(struct ma
old_mask = umask(0);
fd = open(path, O_RDWR|O_CREAT|O_TRUNC, index->mode);
umask(old_mask);
- if (fd == -1)
- return mail_index_file_set_syscall_error(index, path, "open()");
+ if (fd == -1) {
+ mail_index_file_set_syscall_error(index, path, "creat()");
+ return -1;
+ }
mail_index_fchown(index, fd, path);
return fd;
@@ -800,6 +802,8 @@ int mail_index_file_set_syscall_error(st
const char *filepath,
const char *function)
{
+ const char *errstr;
+
i_assert(filepath != NULL);
i_assert(function != NULL);
@@ -810,8 +814,13 @@ int mail_index_file_set_syscall_error(st
}
if (errno == EACCES) {
- return mail_index_set_error(index, "%s",
- eacces_error_get(t_strcut(function, '('), filepath));
+ function = t_strcut(function, '(');
+ if (strcmp(function, "creat") == 0 ||
+ strncmp(function, "file_dotlock_", 13) == 0)
+ errstr = eacces_error_get_creating(function, filepath);
+ else
+ errstr = eacces_error_get(function, filepath);
+ return mail_index_set_error(index, "%s", errstr);
} else {
return mail_index_set_error(index, "%s failed with file %s: %m",
function, filepath);
More information about the dovecot-cvs
mailing list