Commit ac26e0ea ac26e0ea68371b4e7b13e3a50e135f94cdd6fd11 by Sergey Poznyakoff

(mailbox_flush): Do not re-save all messages if the mailbox was opened in append mode.

1 parent d4907075
...@@ -209,7 +209,11 @@ mailbox_flush (mailbox_t mbox, int expunge) ...@@ -209,7 +209,11 @@ mailbox_flush (mailbox_t mbox, int expunge)
209 if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND))) 209 if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
210 return EACCES; 210 return EACCES;
211 mailbox_messages_count (mbox, &total); 211 mailbox_messages_count (mbox, &total);
212 for (i = 1; i <= total; i++) 212 if (mbox->flags & MU_STREAM_APPEND)
213 i = total;
214 else
215 i = 1;
216 for ( ; i <= total; i++)
213 { 217 {
214 message_t msg = NULL; 218 message_t msg = NULL;
215 attribute_t attr = NULL; 219 attribute_t attr = NULL;
......