[PATCH 03/13] setseen overwrite
Bron Gondwana
brong at fastmail.fm
Tue Jan 27 23:15:30 EST 2009
When syncserver gets a setseen_all, it contains an entire skiplist file
from the master. What, skiplist you say? Yeah - I'm afraid so. It's
sent in binary. That sucks, but here we have it. Fixing that would be
a protocol change.
But... at least we can just copy the whole thing into place rather than
fiddling about updating individual fields. We _know_ it's correct
because the master is always right[tm]. Why bother checking each field?
===================================================================
---
imap/sync_server.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/imap/sync_server.c b/imap/sync_server.c
index 11a7360..4808c47 100644
--- a/imap/sync_server.c
+++ b/imap/sync_server.c
@@ -2209,11 +2209,14 @@ static void cmd_setseen_all(char *user, struct buf *data)
r = IMAP_IOERROR;
}
- /* we were operating on the seen state, so merge it and cleanup */
- if (!r) seen_merge(fnamebuf, seen_file);
+ /* XXX - load fnamebuf as a skiplist file and ensure that
+ * it's actually valid! */
+
+ /* overwrite the old seen file */
+ if (!r) rename(fnamebuf, seen_file);
+ else unlink(fnamebuf);
free(seen_file);
- unlink(fnamebuf);
if (filefd != -1) close(filefd);
if (r)
--
1.5.6.3
More information about the Cyrus-devel
mailing list