]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Use mail_storage_set_critical() instead of i_error() directly.
authorTimo Sirainen <tss@iki.fi>
Sat, 1 Nov 2008 12:55:28 +0000 (14:55 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 1 Nov 2008 12:55:28 +0000 (14:55 +0200)
--HG--
branch : HEAD

src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/maildir/maildir-save.c
src/lib-storage/index/maildir/maildir-storage.c
src/lib-storage/index/maildir/maildir-uidlist.c
src/lib-storage/index/mbox/mbox-file.c
src/lib-storage/index/mbox/mbox-lock.c
src/lib-storage/index/shared/shared-storage.c

index e2ebd5dbb35aa5dad7559d832555ab278a3fdeec..a29b06a48fe6d413514744c2d8c6b47a3c4fbdbc 100644 (file)
@@ -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) {
index 3418cf5455f4bc779263c57a9f3ba3d7d3470a03..5d290c5a4f31e11492dd3eb4501e6d593e001817 100644 (file)
@@ -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;
                }
        }
index 09344e4dbe4a1563977aa92927d28c200a51635c..8b8caaee172f461df0827e950e6208e154fc1a5e 100644 (file)
@@ -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;
 }
index 01040779f48e2114fe43cf2676ffa5de20eb68bc..b2b1033d1f59b146eb5ac4ab3af14327a7687d3a 100644 (file)
@@ -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;
 }
index 54ed986990dd11d8d2691676030b3b58be7ffd0d..1b025dabec8203295affdfa15c69381633ed4e5c 100644 (file)
@@ -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;
        }
 }
index 8748755a528eca48f79feb798ceab2d1785b58c7..9beddb127901412ea0bd42f158750a8a834e67f6 100644 (file)
@@ -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;
 }
index 5e097eacb35793190b333b3c990207b38f987d38..34866c4285215e2add78e69f13c2fb227a1fe65e 100644 (file)
@@ -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