Common subdirectories: cyrus-imapd-2.3.7/imap/CVS and cyrus-imapd-2.3.7-abort-upload/imap/CVS diff -u cyrus-imapd-2.3.7/imap/sync_client.c cyrus-imapd-2.3.7-abort-upload/imap/sync_client.c --- cyrus-imapd-2.3.7/imap/sync_client.c Sun May 13 11:56:58 2007 +++ cyrus-imapd-2.3.7-abort-upload/imap/sync_client.c Tue May 15 19:08:07 2007 @@ -1179,6 +1179,9 @@ if (r) { syslog(LOG_ERR, "IOERROR: opening message file %lu of %s: %m", record->uid, mailbox->name); + prot_printf(toserver, " "); /* A space so flags parsing completes */ + prot_flush(toserver); + sync_msgid_remove(msgid_onserver, &record->uuid); return(IMAP_IOERROR); } diff -u cyrus-imapd-2.3.7/imap/sync_server.c cyrus-imapd-2.3.7-abort-upload/imap/sync_server.c --- cyrus-imapd-2.3.7/imap/sync_server.c Sun May 13 11:56:58 2007 +++ cyrus-imapd-2.3.7-abort-upload/imap/sync_server.c Tue May 15 18:36:46 2007 @@ -1870,13 +1870,24 @@ goto parse_err; } - message = sync_message_add(message_list, &item->uuid); + if ((c = prot_getc(sync_in)) == EOF || !isdigit(c)) + { + /* Make sure cache data flushed to disk before we commit */ + sync_message_fsync(message_list); + sync_message_list_cache_flush(message_list); + sync_upload_list_free(&upload_list); + syslog(LOG_ERR, "IOERROR: UPLOAD ABORT"); + return; + } + + prot_ungetc(c, sync_in); /* Parse Message (header size, content lines, cache, message body */ if ((c = getastring(sync_in, sync_out, &arg)) != ' ') { err = "Invalid Header Size"; goto parse_err; } + message = sync_message_add(message_list, &item->uuid); message->hdr_size = sync_atoul(arg.s); if ((c = getastring(sync_in, sync_out, &arg)) != ' ') { diff -u cyrus-imapd-2.3.7/imap/sync_support.c cyrus-imapd-2.3.7-abort-upload/imap/sync_support.c --- cyrus-imapd-2.3.7/imap/sync_support.c Sun May 13 11:56:59 2007 +++ cyrus-imapd-2.3.7-abort-upload/imap/sync_support.c Sun May 13 12:03:25 2007 @@ -544,6 +544,25 @@ return(NULL); } +struct sync_msgid *sync_msgid_remove(struct sync_msgid_list *l, + struct message_uuid *uuid) +{ + int offset = message_uuid_hash(uuid, l->hash_size); + struct sync_msgid *msgid; + + if (message_uuid_isnull(uuid)) + return(NULL); + + for (msgid = l->hash[offset] ; msgid ; msgid = msgid->hash_next) { + if (message_uuid_compare(&msgid->uuid, uuid)) + { + msgid->uuid.value[0] = 0; + return; + } + } + return(NULL); +} + /* ====================================================================== */ struct sync_folder_list *sync_folder_list_create(void) diff -u cyrus-imapd-2.3.7/imap/sync_support.h cyrus-imapd-2.3.7-abort-upload/imap/sync_support.h --- cyrus-imapd-2.3.7/imap/sync_support.h Sun May 13 11:56:59 2007 +++ cyrus-imapd-2.3.7-abort-upload/imap/sync_support.h Sun May 13 12:11:21 2007 @@ -143,6 +143,9 @@ struct sync_msgid *sync_msgid_add(struct sync_msgid_list *list, struct message_uuid *uuid); +struct sync_msgid *sync_msgid_remove(struct sync_msgid_list *list, + struct message_uuid *uuid); + struct sync_msgid *sync_msgid_lookup(struct sync_msgid_list *list, struct message_uuid *uuid);