From: Timo Sirainen Date: Thu, 6 Nov 2008 13:33:53 +0000 (+0200) Subject: Maildir saving: Handle "out of disk space/quota" failures in fsync() and close(). X-Git-Tag: 1.2.alpha4~100 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdb4a82b7f4bc1f45180461f06582a568ee706e8;p=thirdparty%2Fdovecot%2Fcore.git Maildir saving: Handle "out of disk space/quota" failures in fsync() and close(). Those failures could happen with NFS (close() only if fsync_disable=yes). --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/maildir/maildir-save.c b/src/lib-storage/index/maildir/maildir-save.c index 5d290c5a4f..24a083c544 100644 --- a/src/lib-storage/index/maildir/maildir-save.c +++ b/src/lib-storage/index/maildir/maildir-save.c @@ -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;