[dovecot-cvs] dovecot/src/lib-storage/list mailbox-list-fs-iter.c, 1.5, 1.6 mailbox-list-fs.c, 1.8, 1.9 mailbox-list-maildir.c, 1.7, 1.8 subscription-file.c, 1.4, 1.5
tss at dovecot.org
tss at dovecot.org
Sun May 13 20:11:03 EEST 2007
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-file.c, 1.20, 1.21 mbox-lock.c, 1.29, 1.30 mbox-save.c, 1.113, 1.114 mbox-storage.c, 1.183, 1.184 mbox-sync.c, 1.210, 1.211
- Next message: [dovecot-cvs] dovecot/src/plugins/acl acl-mailbox-list.c, 1.6, 1.7 acl-mailbox.c, 1.6, 1.7 acl-storage.c, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/list
In directory talvi:/tmp/cvs-serv20721/lib-storage/list
Modified Files:
mailbox-list-fs-iter.c mailbox-list-fs.c
mailbox-list-maildir.c subscription-file.c
Log Message:
Error handling rewrite.
Index: mailbox-list-fs-iter.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/list/mailbox-list-fs-iter.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mailbox-list-fs-iter.c 17 Apr 2007 15:39:30 -0000 1.5
+++ mailbox-list-fs-iter.c 13 May 2007 17:11:00 -0000 1.6
@@ -68,7 +68,8 @@
/* subfolder, ignore */
return 0;
}
- mailbox_list_set_error(list, "Access denied");
+ mailbox_list_set_error(list, MAIL_ERROR_PERM,
+ MAIL_ERRSTR_NO_PERMISSION);
return -1;
}
@@ -92,7 +93,8 @@
/* check that we're not trying to do any "../../" lists */
if (!mailbox_list_is_valid_mask(_list, mask)) {
- mailbox_list_set_error(_list, "Invalid mask");
+ mailbox_list_set_error(_list, MAIL_ERROR_PARAMS,
+ "Invalid mask");
ctx->ctx.failed = TRUE;
return &ctx->ctx;
}
Index: mailbox-list-fs.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/list/mailbox-list-fs.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mailbox-list-fs.c 11 Apr 2007 10:32:02 -0000 1.8
+++ mailbox-list-fs.c 13 May 2007 17:11:00 -0000 1.9
@@ -272,19 +272,6 @@
return mailbox_list_delete_index_control(list, name);
}
-static bool fs_handle_errors(struct mailbox_list *list)
-{
- if (ENOACCESS(errno))
- mailbox_list_set_error(list, MAILBOX_LIST_ERR_NO_PERMISSION);
- else if (ENOSPACE(errno))
- mailbox_list_set_error(list, "Not enough disk space");
- else if (ENOTFOUND(errno))
- mailbox_list_set_error(list, "Directory structure is broken");
- else
- return FALSE;
- return TRUE;
-}
-
static int fs_list_rename_mailbox(struct mailbox_list *list,
const char *oldname, const char *newname)
{
@@ -301,7 +288,7 @@
if (p != NULL) {
p = t_strdup_until(newpath, p);
if (mkdir_parents(p, CREATE_MODE) < 0) {
- if (fs_handle_errors(list))
+ if (mailbox_list_set_error_from_errno(list))
return -1;
mailbox_list_set_critical(list,
@@ -315,10 +302,11 @@
possibility that someone actually tries to rename two mailboxes
to same new one */
if (lstat(newpath, &st) == 0) {
- mailbox_list_set_error(list, "Target mailbox already exists");
+ mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
+ "Target mailbox already exists");
return -1;
} else if (errno == ENOTDIR) {
- mailbox_list_set_error(list,
+ mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
"Target mailbox doesn't allow inferior mailboxes");
return -1;
} else if (errno != ENOENT && errno != EACCES) {
@@ -331,9 +319,9 @@
the next time it's needed. */
if (rename(oldpath, newpath) < 0) {
if (ENOTFOUND(errno)) {
- mailbox_list_set_error(list, t_strdup_printf(
- MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, oldname));
- } else if (!fs_handle_errors(list)) {
+ mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(oldname));
+ } else if (!mailbox_list_set_error_from_errno(list)) {
mailbox_list_set_critical(list,
"rename(%s, %s) failed: %m", oldpath, newpath);
}
Index: mailbox-list-maildir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/list/mailbox-list-maildir.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mailbox-list-maildir.c 30 Mar 2007 19:30:39 -0000 1.7
+++ mailbox-list-maildir.c 13 May 2007 17:11:00 -0000 1.8
@@ -383,8 +383,8 @@
if (ret < 0)
return -1;
if (!found && ret == 0) {
- mailbox_list_set_error(list, t_strdup_printf(
- MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, oldname));
+ mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(oldname));
return -1;
}
@@ -392,7 +392,8 @@
}
if (EDESTDIREXISTS(errno)) {
- mailbox_list_set_error(list, "Target mailbox already exists");
+ mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
+ "Target mailbox already exists");
} else {
mailbox_list_set_critical(list, "rename(%s, %s) failed: %m",
oldpath, newpath);
Index: subscription-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/list/subscription-file.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- subscription-file.c 14 Feb 2007 18:32:25 -0000 1.4
+++ subscription-file.c 13 May 2007 17:11:00 -0000 1.5
@@ -30,9 +30,10 @@
{
i_assert(function != NULL);
- if (errno == EACCES)
- mailbox_list_set_error(list, "Permission denied");
- else {
+ if (errno == EACCES) {
+ mailbox_list_set_error(list, MAIL_ERROR_PERM,
+ MAIL_ERRSTR_NO_PERMISSION);
+ } else {
mailbox_list_set_critical(list,
"%s failed with subscription file %s: %m",
function, path);
@@ -97,7 +98,7 @@
fd_out = file_dotlock_open(&dotlock_set, path, 0, &dotlock);
if (fd_out == -1) {
if (errno == EAGAIN) {
- mailbox_list_set_error(list,
+ mailbox_list_set_error(list, MAIL_ERROR_TEMP,
"Timeout waiting for subscription file lock");
} else {
subsfile_set_syscall_error(list,
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-file.c, 1.20, 1.21 mbox-lock.c, 1.29, 1.30 mbox-save.c, 1.113, 1.114 mbox-storage.c, 1.183, 1.184 mbox-sync.c, 1.210, 1.211
- Next message: [dovecot-cvs] dovecot/src/plugins/acl acl-mailbox-list.c, 1.6, 1.7 acl-mailbox.c, 1.6, 1.7 acl-storage.c, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list