]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Fix crash at error handling
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 17 Jan 2019 10:13:38 +0000 (12:13 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 1 Dec 2021 11:45:26 +0000 (11:45 +0000)
At this point dest_mail is already NULL. Mainly could happen when running
out of disk space.

src/lib-storage/index/maildir/maildir-save.c

index f4396fcf15fbd5108a7cb32b6b476511cd8eba50..5cf7d6abb2893e778fc43a077f45a469bfc3002c 100644 (file)
@@ -105,9 +105,9 @@ static int maildir_file_move(struct maildir_save_context *ctx,
                                       MAIL_ERRSTR_NO_QUOTA);
                return -1;
        } else {
-               mail_set_critical(ctx->ctx.dest_mail,
-                                 "rename(%s, %s) failed: %m",
-                                 tmp_path, new_path);
+               mailbox_set_critical(&ctx->mbox->box,
+                                    "rename(%s, %s) failed: %m",
+                                    tmp_path, new_path);
                return -1;
        }
 }
@@ -666,14 +666,14 @@ static int maildir_transaction_fsync_dirs(struct maildir_save_context *ctx,
 
        if (new_changed) {
                if (fdatasync_path(ctx->newdir) < 0) {
-                       mail_set_critical(ctx->ctx.dest_mail,
+                       mailbox_set_critical(&ctx->mbox->box,
                                "fdatasync_path(%s) failed: %m", ctx->newdir);
                        return -1;
                }
        }
        if (cur_changed) {
                if (fdatasync_path(ctx->curdir) < 0) {
-                       mail_set_critical(ctx->ctx.dest_mail,
+                       mailbox_set_critical(&ctx->mbox->box,
                                "fdatasync_path(%s) failed: %m", ctx->curdir);
                        return -1;
                }