changeset 10628:568c437ad951 HEAD

expire-tool: Check and log an error if dict iteration fails.
author Timo Sirainen <tss@iki.fi>
date Tue, 02 Feb 2010 15:20:04 +0200
parents 5e50d5597474
children bbfa22045215
files src/plugins/expire/expire-tool.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/expire/expire-tool.c	Tue Feb 02 15:18:25 2010 +0200
+++ b/src/plugins/expire/expire-tool.c	Tue Feb 02 15:20:04 2010 +0200
@@ -230,7 +230,7 @@
 				 DICT_ITERATE_FLAG_SORT_BY_VALUE);
 
 	/* We'll get the oldest values (timestamps) first */
-	while (dict_iterate(iter, &key, &value) > 0) {
+	while ((ret = dict_iterate(iter, &key, &value)) > 0) {
 		/* key = DICT_EXPIRE_PREFIX<user>/<mailbox> */
 		userp = key + strlen(DICT_EXPIRE_PREFIX);
 
@@ -263,6 +263,7 @@
 
 		if (ret < 0) {
 			/* failed to update */
+			ret = 0;
 		} else if (next_expire == 0) {
 			/* no more messages or mailbox deleted */
 			if (!testrun)
@@ -287,6 +288,8 @@
 			} T_END;
 		}
 	}
+	if (ret < 0)
+		i_error("Dictionary iteration failed");
 	if (testrun && userp == NULL)
 		i_info("No entries in dictionary");