diff options
-rw-r--r-- | libproto/dotmail/dotmail.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libproto/dotmail/dotmail.c b/libproto/dotmail/dotmail.c index 48ca75673..fa083bb98 100644 --- a/libproto/dotmail/dotmail.c +++ b/libproto/dotmail/dotmail.c @@ -320,24 +320,27 @@ dotmail_rescan_unlocked (mu_mailbox_t mailbox, mu_off_t offset) } state = dotmail_scan_init; struct mu_dotmail_message *dmsg; size_t lines = 0; int rc; static char *expect[] = { "status: ", "x-imapbase:", "x-uid: ", }; int i, j; int force_init_uids = 0; + if (!(mailbox->flags & MU_STREAM_READ)) + return 0; + rc = mu_streamref_create (&stream, mailbox->stream); if (rc) { mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR, ("%s:%s (%s): %s", __func__, "mu_streamref_create", dmp->name, mu_strerror (rc))); return rc; } rc = mu_stream_seek (stream, offset, MU_SEEK_SET, NULL); if (rc) @@ -581,24 +584,27 @@ dotmail_rescan_unlocked (mu_mailbox_t mailbox, mu_off_t offset) } /* Scan the mailbox starting from the given offset */ static int dotmail_rescan (mu_mailbox_t mailbox, mu_off_t offset) { struct mu_dotmail_mailbox *dmp = mailbox->data; int rc; if (!dmp) return EINVAL; + if (!(mailbox->flags & MU_STREAM_READ)) + return 0; + mu_monitor_wrlock (mailbox->monitor); #ifdef WITH_PTHREAD pthread_cleanup_push (dotmail_cleanup, (void *)mailbox); #endif rc = mu_stream_size (mailbox->stream, &dmp->size); if (rc != 0) { mu_monitor_unlock (mailbox->monitor); return rc; } |