changeset 20291:9e37b54aab05

mailbox-alias plugin: Fixed error handling
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 05 Jun 2016 15:31:20 +0300
parents f5552f2ec3e1
children a0c09e408ef9
files src/plugins/mailbox-alias/mailbox-alias-plugin.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/mailbox-alias/mailbox-alias-plugin.c	Sun Jun 05 15:26:11 2016 +0300
+++ b/src/plugins/mailbox-alias/mailbox-alias-plugin.c	Sun Jun 05 15:31:20 2016 +0300
@@ -225,7 +225,9 @@
 		return -1;
 	}
 
-	if (mailbox_is_alias_symlink(box)) {
+	if ((ret = mailbox_is_alias_symlink(box)) < 0)
+		return -1;
+	if (ret > 0) {
 		/* we're deleting an alias mailbox. we'll need to handle this
 		   explicitly since box->name points to the original mailbox */
 		symlink_name = alist->module_ctx.super.
@@ -245,12 +247,16 @@
 	struct mailbox_alias_mailbox *abox = MAILBOX_ALIAS_CONTEXT(src);
 	int ret;
 
-	if (mailbox_is_alias_symlink(src)) {
+	if ((ret = mailbox_is_alias_symlink(src)) < 0)
+		return -1;
+	else if (ret > 0) {
 		mail_storage_set_error(src->storage, MAIL_ERROR_NOTPOSSIBLE,
 				       "Can't rename alias mailboxes");
 		return -1;
 	}
-	if (mailbox_is_alias_symlink(dest)) {
+	if ((ret = mailbox_is_alias_symlink(dest)) < 0)
+		return -1;
+	else {
 		mail_storage_set_error(src->storage, MAIL_ERROR_NOTPOSSIBLE,
 				       "Can't rename to mailbox alias");
 		return -1;