dovecot-2.0: lib-storage: Don't write to dovecot.mailbox.log if ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 4 18:01:12 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/45812039b7ce
changeset: 12239:45812039b7ce
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 04 16:01:09 2010 +0100
description:
lib-storage: Don't write to dovecot.mailbox.log if setting subscription didn't actually change anything.

diffstat:

 src/lib-storage/list/subscription-file.c |  2 +-
 src/lib-storage/list/subscription-file.h |  1 +
 src/lib-storage/mailbox-list.c           |  5 +++--
 3 files changed, 5 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r 2b8b2875af26 -r 45812039b7ce src/lib-storage/list/subscription-file.c
--- a/src/lib-storage/list/subscription-file.c	Mon Oct 04 15:55:34 2010 +0100
+++ b/src/lib-storage/list/subscription-file.c	Mon Oct 04 16:01:09 2010 +0100
@@ -195,7 +195,7 @@
 			failed = TRUE;
 		}
 	}
-	return failed ? -1 : 0;
+	return failed ? -1 : (changed ? 1 : 0);
 }
 
 struct subsfile_list_context *
diff -r 2b8b2875af26 -r 45812039b7ce src/lib-storage/list/subscription-file.h
--- a/src/lib-storage/list/subscription-file.h	Mon Oct 04 15:55:34 2010 +0100
+++ b/src/lib-storage/list/subscription-file.h	Mon Oct 04 16:01:09 2010 +0100
@@ -13,6 +13,7 @@
 /* Returns the next subscribed mailbox, or NULL. */
 const char *subsfile_list_next(struct subsfile_list_context *ctx);
 
+/* Returns 1 if subscribed, 0 if no changes done, -1 if error. */
 int subsfile_set_subscribed(struct mailbox_list *list, const char *path,
 			    const char *temp_prefix, const char *name,
 			    bool set);
diff -r 2b8b2875af26 -r 45812039b7ce src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c	Mon Oct 04 15:55:34 2010 +0100
+++ b/src/lib-storage/mailbox-list.c	Mon Oct 04 16:01:09 2010 +0100
@@ -1146,9 +1146,10 @@
 				const char *name, bool set)
 {
 	uint8_t guid[MAIL_GUID_128_SIZE];
+	int ret;
 
-	if (list->v.set_subscribed(list, name, set) < 0)
-		return -1;
+	if ((ret = list->v.set_subscribed(list, name, set)) <= 0)
+		return ret;
 
 	/* subscriptions are about names, not about mailboxes. it's possible
 	   to have a subscription to nonexistent mailbox. renames also don't


More information about the dovecot-cvs mailing list