From: Aki Tuomi Date: Mon, 28 Nov 2016 13:17:55 +0000 (+0200) Subject: mail-crypt: Add error handling for mailbox_open in tests X-Git-Tag: 2.2.27~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8ca3069148c7cfdb9c9697010fea0eda8733d85;p=thirdparty%2Fdovecot%2Fcore.git mail-crypt: Add error handling for mailbox_open in tests --- diff --git a/src/plugins/mail-crypt/test-mail-key.c b/src/plugins/mail-crypt/test-mail-key.c index 67c517c3aa..b663edcb95 100644 --- a/src/plugins/mail-crypt/test-mail-key.c +++ b/src/plugins/mail-crypt/test-mail-key.c @@ -249,7 +249,9 @@ static void test_generate_inbox_key(void) mail_namespace_find_inbox(test_mail_user->namespaces); struct mailbox *box = mailbox_alloc(ns->list, "INBOX", MAILBOX_FLAG_READONLY); - mailbox_open(box); + if (mailbox_open(box) < 0) + i_fatal("mailbox_open(INBOX) failed: %s", + mailbox_get_last_error(box, NULL)); if (mail_crypt_box_generate_keypair(box, &pair, user_key, &pubid, &error) < 0) { i_error("generate_keypair failed: %s", error); @@ -308,7 +310,9 @@ static void test_verify_keys(void) mail_namespace_find_inbox(test_mail_user->namespaces); struct mailbox *box = mailbox_alloc(ns->list, "INBOX", MAILBOX_FLAG_READONLY); - mailbox_open(box); + if (mailbox_open(box) < 0) + i_fatal("mailbox_open(INBOX) failed: %s", + mailbox_get_last_error(box, NULL)); /* verify links */ /* user's public key */ @@ -403,7 +407,9 @@ static void test_old_key(void) mail_namespace_find_inbox(test_mail_user->namespaces); struct mailbox *box = mailbox_alloc(ns->list, "INBOX", MAILBOX_FLAG_READONLY); - mailbox_open(box); + if (mailbox_open(box) < 0) + i_fatal("mailbox_open(INBOX) failed: %s", + mailbox_get_last_error(box, NULL)); struct mailbox_transaction_context *t = mailbox_transaction_begin(box, 0);