[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-save.c, 1.24, 1.25 dbox-storage.c, 1.52, 1.53 dbox-uidlist.c, 1.48, 1.49
tss at dovecot.org
tss at dovecot.org
Sun May 13 20:10:54 EEST 2007
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/cydir cydir-save.c, 1.5, 1.6 cydir-storage.c, 1.13, 1.14
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c, 1.52, 1.53 maildir-save.c, 1.87, 1.88 maildir-storage.c, 1.166, 1.167 maildir-uidlist.c, 1.66, 1.67 maildir-util.c, 1.24, 1.25
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv20721/lib-storage/index/dbox
Modified Files:
dbox-save.c dbox-storage.c dbox-uidlist.c
Log Message:
Error handling rewrite.
Index: dbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-save.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dbox-save.c 17 Apr 2007 17:18:00 -0000 1.24
+++ dbox-save.c 13 May 2007 17:10:51 -0000 1.25
@@ -252,16 +252,14 @@
int dbox_save_continue(struct mail_save_context *_ctx)
{
struct dbox_save_context *ctx = (struct dbox_save_context *)_ctx;
+ struct mail_storage *storage = &ctx->mbox->storage->storage;
if (ctx->failed)
return -1;
if (o_stream_send_istream(ctx->file->output, ctx->input) < 0) {
- if (ENOSPACE(ctx->file->output->stream_errno)) {
- mail_storage_set_error(&ctx->mbox->storage->storage,
- "Not enough disk space");
- } else {
- mail_storage_set_critical(&ctx->mbox->storage->storage,
+ if (!mail_storage_set_error_from_errno(storage)) {
+ mail_storage_set_critical(storage,
"o_stream_send_istream(%s) failed: %m",
ctx->file->path);
}
Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- dbox-storage.c 17 Apr 2007 12:41:27 -0000 1.52
+++ dbox-storage.c 13 May 2007 17:10:51 -0000 1.53
@@ -257,16 +257,11 @@
static int create_dbox(struct mail_storage *storage, const char *path)
{
- const char *error;
-
if (mkdir_parents(path, CREATE_MODE) < 0 && errno != EEXIST) {
- if (mail_storage_errno2str(&error)) {
- mail_storage_set_error(storage, "%s", error);
- return -1;
+ if (!mail_storage_set_error_from_errno(storage)) {
+ mail_storage_set_critical(storage,
+ "mkdir(%s) failed: %m", path);
}
-
- mail_storage_set_critical(storage, "mkdir(%s) failed: %m",
- path);
return -1;
}
return 0;
@@ -391,8 +386,8 @@
if (stat(path, &st) == 0) {
return dbox_open(storage, name, flags);
} else if (errno == ENOENT) {
- mail_storage_set_error(_storage,
- MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name);
+ mail_storage_set_error(_storage, MAIL_ERROR_NOTFOUND,
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
return NULL;
} else {
mail_storage_set_critical(_storage, "stat(%s) failed: %m",
@@ -411,7 +406,8 @@
path = mailbox_list_get_path(_storage->list, name,
MAILBOX_LIST_PATH_TYPE_MAILBOX);
if (stat(path, &st) == 0) {
- mail_storage_set_error(_storage, "Mailbox already exists");
+ mail_storage_set_error(_storage, MAIL_ERROR_NOTPOSSIBLE,
+ "Mailbox already exists");
return -1;
}
@@ -423,7 +419,7 @@
{
struct dbox_storage *storage = DBOX_LIST_CONTEXT(list);
struct stat st;
- const char *path, *mail_path, *error;
+ const char *path, *mail_path;
/* make sure the indexes are closed before trying to delete the
directory that contains them */
@@ -440,8 +436,8 @@
if (stat(mail_path, &st) < 0 && ENOTFOUND(errno)) {
if (stat(path, &st) < 0) {
/* doesn't exist at all */
- mailbox_list_set_error(list, t_strdup_printf(
- MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name));
+ mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
return -1;
}
@@ -450,9 +446,9 @@
return 0;
if (errno == ENOTEMPTY) {
- mailbox_list_set_error(list, t_strdup_printf(
- "Directory %s isn't empty, can't delete it.",
- name));
+ mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
+ t_strdup_printf("Directory %s isn't empty, "
+ "can't delete it.", name));
} else {
mailbox_list_set_critical(list,
"rmdir() failed for %s: %m", path);
@@ -463,9 +459,7 @@
if (unlink_directory(mail_path, TRUE) < 0) {
- if (mail_storage_errno2str(&error))
- mailbox_list_set_error(list, error);
- else {
+ if (!mailbox_list_set_error_from_errno(list)) {
mailbox_list_set_critical(list,
"unlink_directory() failed for %s: %m",
mail_path);
Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- dbox-uidlist.c 30 Mar 2007 12:44:03 -0000 1.48
+++ dbox-uidlist.c 13 May 2007 17:10:51 -0000 1.49
@@ -439,8 +439,7 @@
if (uidlist->lock_fd == -1) {
if (errno == EAGAIN) {
mail_storage_set_error(&mbox->storage->storage,
- "Timeout while waiting for lock");
- mbox->storage->storage.temporary_error = TRUE;
+ MAIL_ERROR_TEMP, MAIL_ERRSTR_LOCK_TIMEOUT);
return 0;
}
mail_storage_set_critical(&mbox->storage->storage,
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/cydir cydir-save.c, 1.5, 1.6 cydir-storage.c, 1.13, 1.14
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c, 1.52, 1.53 maildir-save.c, 1.87, 1.88 maildir-storage.c, 1.166, 1.167 maildir-uidlist.c, 1.66, 1.67 maildir-util.c, 1.24, 1.25
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list