dovecot-2.0: lib-storage: Don't log rename() error if dovecot-ui...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 31 20:57:50 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/2bb7ce1fb8a0
changeset: 11434:2bb7ce1fb8a0
user: Timo Sirainen <tss at iki.fi>
date: Mon May 31 18:57:46 2010 +0100
description:
lib-storage: Don't log rename() error if dovecot-uidvalidity didn't contain valid value.
diffstat:
src/lib-storage/mailbox-uidvalidity.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (54 lines):
diff -r c4f56ed9dae0 -r 2bb7ce1fb8a0 src/lib-storage/mailbox-uidvalidity.c
--- a/src/lib-storage/mailbox-uidvalidity.c Mon May 31 16:46:08 2010 +0100
+++ b/src/lib-storage/mailbox-uidvalidity.c Mon May 31 18:57:46 2010 +0100
@@ -67,7 +67,9 @@
i_error("close(%s) failed: %m", path);
}
-static int mailbox_uidvalidity_rename(const char *path, uint32_t *uid_validity)
+static int
+mailbox_uidvalidity_rename(const char *path, uint32_t *uid_validity,
+ bool log_enoent)
{
string_t *src, *dest;
unsigned int i, prefix_len;
@@ -80,6 +82,9 @@
prefix_len = str_len(src);
for (i = 0; i < RETRY_COUNT; i++) {
+ str_truncate(src, prefix_len);
+ str_truncate(dest, prefix_len);
+
str_printfa(src, ".%08x", *uid_validity);
*uid_validity += 1;
str_printfa(dest, ".%08x", *uid_validity);
@@ -89,10 +94,8 @@
break;
/* possibly a race condition. try the next value. */
- str_truncate(src, prefix_len);
- str_truncate(dest, prefix_len);
}
- if (ret < 0)
+ if (ret < 0 && (errno != ENOENT || log_enoent))
i_error("rename(%s, %s) failed: %m", str_c(src), str_c(dest));
return ret;
}
@@ -175,7 +178,7 @@
}
cur_value = max_value;
- if (mailbox_uidvalidity_rename(path, &cur_value) < 0)
+ if (mailbox_uidvalidity_rename(path, &cur_value, TRUE) < 0)
return mailbox_uidvalidity_next_fallback();
mailbox_uidvalidity_write(list, path, cur_value);
return cur_value;
@@ -208,7 +211,7 @@
}
/* we now have the current uidvalidity value that's hopefully correct */
- if (mailbox_uidvalidity_rename(path, &cur_value) < 0)
+ if (mailbox_uidvalidity_rename(path, &cur_value, FALSE) < 0)
return mailbox_uidvalidity_next_rescan(list, path);
/* fast path succeeded. write the current value to the main
More information about the dovecot-cvs
mailing list