changeset 8389:b9e34721e74c HEAD

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).
author Timo Sirainen <tss@iki.fi>
date Thu, 06 Nov 2008 15:33:53 +0200
parents 4a608f96609b
children db0c70913765
files src/lib-storage/index/maildir/maildir-save.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-save.c	Wed Nov 05 20:03:05 2008 +0200
+++ b/src/lib-storage/index/maildir/maildir-save.c	Thu Nov 06 15:33:53 2008 +0200
@@ -496,14 +496,18 @@
 
 	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;