]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Maildir saving: Handle "out of disk space/quota" failures in fsync() and close().
authorTimo Sirainen <tss@iki.fi>
Thu, 6 Nov 2008 13:33:53 +0000 (15:33 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 6 Nov 2008 13:33:53 +0000 (15:33 +0200)
Those failures could happen with NFS (close() only if fsync_disable=yes).

--HG--
branch : HEAD

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

index 5d290c5a4f31e11492dd3eb4501e6d593e001817..24a083c544c959c21bf8a17cc10adeaf6334d2de 100644 (file)
@@ -496,14 +496,18 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx)
 
        if (!ctx->mbox->ibox.fsync_disable && !ctx->failed) {
                if (fsync(ctx->fd) < 0) {
-                       mail_storage_set_critical(storage,
+                       if (!mail_storage_set_error_from_errno(storage)) {
+                               mail_storage_set_critical(storage,
                                                  "fsync(%s) failed: %m", path);
+                       }
                        ctx->failed = TRUE;
                }
        }
        if (close(ctx->fd) < 0) {
-               mail_storage_set_critical(storage,
-                                         "close(%s) failed: %m", path);
+               if (!mail_storage_set_error_from_errno(storage)) {
+                       mail_storage_set_critical(storage,
+                                                 "close(%s) failed: %m", path);
+               }
                ctx->failed = TRUE;
        }
        ctx->fd = -1;