Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9577:f707fc6705c7 HEAD
lib-storage: Don't log rename() error if dovecot-uidvalidity didn't contain valid value.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 31 May 2010 18:58:50 +0100 |
parents | eaba4cfeaa44 |
children | 40fc39475d02 |
files | src/lib-storage/mailbox-uidvalidity.c |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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