From: Timo Sirainen Date: Sat, 1 Nov 2008 12:55:28 +0000 (+0200) Subject: Use mail_storage_set_critical() instead of i_error() directly. X-Git-Tag: 1.2.alpha4~118 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0d16525a729011f4fced989a3da74d755ea49e6d;p=thirdparty%2Fdovecot%2Fcore.git Use mail_storage_set_critical() instead of i_error() directly. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index e2ebd5dbb3..a29b06a48f 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -478,7 +478,8 @@ static void maildir_mail_set_cache_corrupted(struct mail *_mail, _mail->uid, &flags); if (maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE, &size)) { - i_error("Maildir filename has wrong W value: %s/%s", + mail_storage_set_critical(_mail->box->storage, + "Maildir filename has wrong W value: %s/%s", mbox->path, fname); } else if (maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid, MAILDIR_UIDLIST_REC_EXT_VSIZE) != NULL) { diff --git a/src/lib-storage/index/maildir/maildir-save.c b/src/lib-storage/index/maildir/maildir-save.c index 3418cf5455..5d290c5a4f 100644 --- a/src/lib-storage/index/maildir/maildir-save.c +++ b/src/lib-storage/index/maildir/maildir-save.c @@ -579,18 +579,22 @@ maildir_transaction_unlink_copied_files(struct maildir_save_context *ctx, static int maildir_transaction_fsync_dirs(struct maildir_save_context *ctx, bool new_changed, bool cur_changed) { + struct mail_storage *storage = &ctx->mbox->storage->storage; + if (ctx->mbox->ibox.fsync_disable) return 0; if (new_changed) { if (fdatasync_path(ctx->newdir) < 0) { - i_error("fdatasync_path(%s) failed: %m", ctx->newdir); + mail_storage_set_critical(storage, + "fdatasync_path(%s) failed: %m", ctx->newdir); return -1; } } if (cur_changed) { if (fdatasync_path(ctx->curdir) < 0) { - i_error("fdatasync_path(%s) failed: %m", ctx->curdir); + mail_storage_set_critical(storage, + "fdatasync_path(%s) failed: %m", ctx->curdir); return -1; } } diff --git a/src/lib-storage/index/maildir/maildir-storage.c b/src/lib-storage/index/maildir/maildir-storage.c index 09344e4dbe..8b8caaee17 100644 --- a/src/lib-storage/index/maildir/maildir-storage.c +++ b/src/lib-storage/index/maildir/maildir-storage.c @@ -608,7 +608,8 @@ static int maildir_mailbox_create(struct mail_storage *_storage, "Mailbox was deleted while it was being created"); return -1; } else { - i_error("open(%s, O_CREAT) failed: %m", path); + mail_storage_set_critical(_storage, + "open(%s, O_CREAT) failed: %m", path); } return 0; } diff --git a/src/lib-storage/index/maildir/maildir-uidlist.c b/src/lib-storage/index/maildir/maildir-uidlist.c index 01040779f4..b2b1033d1f 100644 --- a/src/lib-storage/index/maildir/maildir-uidlist.c +++ b/src/lib-storage/index/maildir/maildir-uidlist.c @@ -260,9 +260,13 @@ struct maildir_uidlist *maildir_uidlist_init(struct maildir_mailbox *mbox) static void maildir_uidlist_close(struct maildir_uidlist *uidlist) { + struct mail_storage *storage = uidlist->ibox->box.storage; + if (uidlist->fd != -1) { - if (close(uidlist->fd) < 0) - i_error("close(%s) failed: %m", uidlist->path); + if (close(uidlist->fd) < 0) { + mail_storage_set_critical(storage, + "close(%s) failed: %m", uidlist->path); + } uidlist->fd = -1; uidlist->fd_ino = 0; } @@ -694,8 +698,10 @@ maildir_uidlist_update_read(struct maildir_uidlist *uidlist, i_stream_destroy(&input); if (ret <= 0) { - if (close(fd) < 0) - i_error("close(%s) failed: %m", uidlist->path); + if (close(fd) < 0) { + mail_storage_set_critical(storage, + "close(%s) failed: %m", uidlist->path); + } } return ret; } diff --git a/src/lib-storage/index/mbox/mbox-file.c b/src/lib-storage/index/mbox/mbox-file.c index 54ed986990..1b025dabec 100644 --- a/src/lib-storage/index/mbox/mbox-file.c +++ b/src/lib-storage/index/mbox/mbox-file.c @@ -53,7 +53,7 @@ void mbox_file_close(struct mbox_mailbox *mbox) if (mbox->mbox_fd != -1) { if (close(mbox->mbox_fd) < 0) - i_error("close(mbox) failed: %m"); + mbox_set_syscall_error(mbox, "close()"); mbox->mbox_fd = -1; } } diff --git a/src/lib-storage/index/mbox/mbox-lock.c b/src/lib-storage/index/mbox/mbox-lock.c index 8748755a52..9beddb1279 100644 --- a/src/lib-storage/index/mbox/mbox-lock.c +++ b/src/lib-storage/index/mbox/mbox-lock.c @@ -260,7 +260,8 @@ static int mbox_dotlock_privileged_op(struct mbox_mailbox *mbox, orig_dir_fd = open(".", O_RDONLY); if (orig_dir_fd == -1) { - i_error("open(.) failed: %m"); + mail_storage_set_critical(&mbox->storage->storage, + "open(.) failed: %m"); return -1; } @@ -279,7 +280,8 @@ static int mbox_dotlock_privileged_op(struct mbox_mailbox *mbox, } else { dir = t_strdup_until(mbox->path, fname); if (chdir(dir) < 0) { - i_error("chdir(%s) failed: %m", dir); + mail_storage_set_critical(&mbox->storage->storage, + "chdir(%s) failed: %m", dir); (void)close(orig_dir_fd); return -1; } @@ -287,7 +289,8 @@ static int mbox_dotlock_privileged_op(struct mbox_mailbox *mbox, } if (op == MBOX_DOTLOCK_OP_LOCK) { if (access(fname, R_OK) < 0) { - i_error("access(%s) failed: %m", mbox->path); + mail_storage_set_critical(&mbox->storage->storage, + "access(%s) failed: %m", mbox->path); return -1; } } @@ -322,8 +325,10 @@ static int mbox_dotlock_privileged_op(struct mbox_mailbox *mbox, restrict_access_drop_priv_gid(); - if (fchdir(orig_dir_fd) < 0) - i_error("fchdir() failed: %m"); + if (fchdir(orig_dir_fd) < 0) { + mail_storage_set_critical(&mbox->storage->storage, + "fchdir() failed: %m"); + } (void)close(orig_dir_fd); return ret; } diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index 5e097eacb3..34866c4285 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -190,7 +190,8 @@ int shared_storage_get_namespace(struct mail_storage *_storage, var_expand(location, storage->location, tab); if (mail_storage_create(ns, NULL, str_c(location), _storage->flags, _storage->lock_method, &error) < 0) { - i_error("Namespace '%s': %s", ns->prefix, error); + mail_storage_set_critical(_storage, "Namespace '%s': %s", + ns->prefix, error); return -1; } /* FIXME: we could remove namespaces here that don't have usable