dovecot-1.2: lib-storage: Don't log rename() error if dovecot-ui...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 31 20:58:54 EEST 2010
details: http://hg.dovecot.org/dovecot-1.2/rev/f707fc6705c7
changeset: 9577:f707fc6705c7
user: Timo Sirainen <tss at iki.fi>
date: Mon May 31 18:58:50 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 eaba4cfeaa44 -r f707fc6705c7 src/lib-storage/mailbox-uidvalidity.c
--- a/src/lib-storage/mailbox-uidvalidity.c Fri May 28 16:52:23 2010 +0100
+++ b/src/lib-storage/mailbox-uidvalidity.c Mon May 31 18:58:50 2010 +0100
@@ -46,7 +46,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;
@@ -59,6 +61,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);
@@ -68,10 +73,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;
}
@@ -149,7 +152,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(path, cur_value);
return cur_value;
@@ -182,7 +185,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(path);
/* fast path succeeded. write the current value to the main
More information about the dovecot-cvs
mailing list