changeset 8339:672fd089a8f7 HEAD

SELECT: If closing old mailbox gives an error, don't crash.
author Timo Sirainen <tss@iki.fi>
date Sat, 25 Oct 2008 23:34:02 +0300
parents 0ee4090b85fe
children 1bf3afdd6450
files src/imap/cmd-select.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-select.c	Sat Oct 25 23:10:32 2008 +0300
+++ b/src/imap/cmd-select.c	Sat Oct 25 23:34:02 2008 +0300
@@ -359,14 +359,15 @@
 	client->mailbox_change_lock = cmd;
 
 	if (client->mailbox != NULL) {
+		struct mail_storage *old_storage =
+			mailbox_get_storage(client->mailbox);
+
 		client_search_updates_free(client);
 		box = client->mailbox;
 		client->mailbox = NULL;
 
-		if (mailbox_close(&box) < 0) {
-			client_send_untagged_storage_error(client,
-				mailbox_get_storage(box));
-		}
+		if (mailbox_close(&box) < 0)
+			client_send_untagged_storage_error(client, old_storage);
 		/* CLOSED response is required by QRESYNC */
 		client_send_line(client, "* OK [CLOSED]");
 	}