[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c, 1.52, 1.53 maildir-save.c, 1.87, 1.88 maildir-storage.c, 1.166, 1.167 maildir-uidlist.c, 1.66, 1.67 maildir-util.c, 1.24, 1.25

tss at dovecot.org tss at dovecot.org
Sun May 13 20:10:55 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv20721/lib-storage/index/maildir

Modified Files:
	maildir-copy.c maildir-save.c maildir-storage.c 
	maildir-uidlist.c maildir-util.c 
Log Message:
Error handling rewrite.



Index: maildir-copy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-copy.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- maildir-copy.c	30 Mar 2007 12:44:03 -0000	1.52
+++ maildir-copy.c	13 May 2007 17:10:52 -0000	1.53
@@ -72,7 +72,7 @@
 
 		if (ENOSPACE(errno)) {
 			mail_storage_set_error(&mbox->storage->storage,
-					       "Not enough disk space");
+				MAIL_ERROR_NOSPACE, MAIL_ERRSTR_NO_SPACE);
 			return -1;
 		}
 

Index: maildir-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-save.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- maildir-save.c	17 Apr 2007 17:18:02 -0000	1.87
+++ maildir-save.c	13 May 2007 17:10:52 -0000	1.88
@@ -94,7 +94,7 @@
 		ret = -1;
 		if (ENOSPACE(errno)) {
 			mail_storage_set_error(storage,
-					       "Not enough disk space");
+				MAIL_ERROR_NOSPACE, MAIL_ERRSTR_NO_SPACE);
 		} else {
 			mail_storage_set_critical(storage,
 				"rename(%s, %s) failed: %m",
@@ -378,6 +378,7 @@
 int maildir_save_continue(struct mail_save_context *_ctx)
 {
 	struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx;
+	struct mail_storage *storage = &ctx->mbox->storage->storage;
 
 	if (ctx->failed)
 		return -1;
@@ -386,11 +387,8 @@
 		index_mail_cache_parse_continue(ctx->cur_dest_mail);
 
 	if (o_stream_send_istream(ctx->output, ctx->input) < 0) {
-		if (ENOSPACE(errno)) {
-			mail_storage_set_error(&ctx->mbox->storage->storage,
-					       "Not enough disk space");
-		} else {
-			mail_storage_set_critical(&ctx->mbox->storage->storage,
+		if (!mail_storage_set_error_from_errno(storage)) {
+			mail_storage_set_critical(storage,
 				"o_stream_send_istream(%s/%s) failed: %m",
 				ctx->tmpdir, ctx->file_last->basename);
 		}
@@ -466,7 +464,7 @@
 		errno = output_errno;
 		if (ENOSPACE(errno)) {
 			mail_storage_set_error(&ctx->mbox->storage->storage,
-					       "Not enough disk space");
+				MAIL_ERROR_NOSPACE, MAIL_ERRSTR_NO_SPACE);
 		} else if (errno != 0) {
 			mail_storage_set_critical(&ctx->mbox->storage->storage,
 				"write(%s) failed: %m", ctx->mbox->path);

Index: maildir-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- maildir-storage.c	11 May 2007 12:29:58 -0000	1.166
+++ maildir-storage.c	13 May 2007 17:10:52 -0000	1.167
@@ -568,8 +568,8 @@
 
 		return maildir_open(storage, name, flags);
 	} else if (errno == ENOENT) {
-		mail_storage_set_error(_storage,
-			MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name);
+		mail_storage_set_error(_storage, MAIL_ERROR_NOTFOUND,
+			T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
 		return NULL;
 	} else {
 		mail_storage_set_critical(_storage, "stat(%s) failed: %m",
@@ -593,7 +593,7 @@
 	old_mask = umask(0777 ^ mode);
 	if (create_maildir(storage, dir, FALSE) < 0) {
 		if (errno == EEXIST) {
-			mail_storage_set_error(storage,
+			mail_storage_set_error(storage, MAIL_ERROR_NOTPOSSIBLE,
 					       "Mailbox already exists");
 		}
 		umask(old_mask);
@@ -643,7 +643,7 @@
 
 	if (create_maildir(_storage, path, FALSE) < 0) {
 		if (errno == EEXIST) {
-			mail_storage_set_error(_storage,
+			mail_storage_set_error(_storage, MAIL_ERROR_NOTPOSSIBLE,
 					       "Mailbox already exists");
 		}
 		return -1;
@@ -694,8 +694,8 @@
 	dir = opendir(path);
 	if (dir == NULL) {
 		if (errno == ENOENT) {
-			mailbox_list_set_error(list, t_strdup_printf(
-				MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name));
+			mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+				T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
 		} else {
 			mailbox_list_set_critical(list,
 				"opendir(%s) failed: %m", path);
@@ -757,8 +757,9 @@
 	}
 
 	if (!unlinked_something) {
-		mailbox_list_set_error(list, t_strdup_printf(
-			"Directory %s isn't empty, can't delete it.", name));
+		mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
+			t_strdup_printf("Directory %s isn't empty, "
+					"can't delete it.", name));
 		return -1;
 	}
 	return 0;
@@ -785,8 +786,8 @@
 	/* check if the mailbox actually exists */
 	src = mailbox_list_get_path(list, name, MAILBOX_LIST_PATH_TYPE_MAILBOX);
 	if (stat(src, &st) != 0 && errno == ENOENT) {
-		mailbox_list_set_error(list, t_strdup_printf(
-			MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name));
+		mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+			T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
 		return -1;
 	}
 
@@ -805,8 +806,8 @@
 		if (errno == ENOENT) {
 			/* it was just deleted under us by
 			   another process */
-			mailbox_list_set_error(list, t_strdup_printf(
-				MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name));
+			mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+				T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
 			return -1;
 		}
 		if (!EDESTDIREXISTS(errno)) {
@@ -849,7 +850,7 @@
 		path2 = mailbox_list_get_path(list, NULL,
 					      MAILBOX_LIST_PATH_TYPE_MAILBOX);
 		if (strcmp(path1, path2) == 0) {
-			mailbox_list_set_error(list,
+			mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
 				"Renaming INBOX isn't supported.");
 			return -1;
 		}

Index: maildir-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-uidlist.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- maildir-uidlist.c	9 May 2007 13:12:13 -0000	1.66
+++ maildir-uidlist.c	13 May 2007 17:10:52 -0000	1.67
@@ -103,8 +103,7 @@
 	if (fd == -1) {
 		if (errno == EAGAIN) {
 			mail_storage_set_error(&mbox->storage->storage,
-				"Timeout while waiting for lock");
-			mbox->storage->storage.temporary_error = TRUE;
+				MAIL_ERROR_TEMP, MAIL_ERRSTR_LOCK_TIMEOUT);
 			return 0;
 		}
 		mail_storage_set_critical(&mbox->storage->storage,

Index: maildir-util.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-util.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- maildir-util.c	2 Apr 2007 02:49:14 -0000	1.24
+++ maildir-util.c	13 May 2007 17:10:52 -0000	1.25
@@ -135,7 +135,7 @@
 	if (fd == -1) {
 		if (ENOSPACE(errno)) {
 			mail_storage_set_error(&mbox->storage->storage,
-					       "Not enough disk space");
+				MAIL_ERROR_NOSPACE, MAIL_ERRSTR_NO_SPACE);
 		} else {
 			mail_storage_set_critical(&mbox->storage->storage,
 				"open(%s) failed: %m", str_c(path));



More information about the dovecot-cvs mailing list