diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-11-09 11:47:26 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-11-09 11:47:26 +0200 |
commit | caf940a246c29fa75b5f587e38c20c9bc3476f2b (patch) | |
tree | 3cd6feeacfe90b5aff644a886f0ab2e16f7dd9b2 | |
parent | d38d139c7545ed616c0237bab5ca7db24cfccb80 (diff) | |
download | mailutils-caf940a246c29fa75b5f587e38c20c9bc3476f2b.tar.gz mailutils-caf940a246c29fa75b5f587e38c20c9bc3476f2b.tar.bz2 |
dotmail: fix opening in append-only mode
* libproto/dotmail/dotmail.c (dotmail_rescan_unlocked)
(dotmail_rescan): Skip if mailbox is not opened for reading.
-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 | |||
@@ -326,12 +326,15 @@ dotmail_rescan_unlocked (mu_mailbox_t mailbox, mu_off_t offset) | |||
326 | "x-imapbase:", | 326 | "x-imapbase:", |
327 | "x-uid: ", | 327 | "x-uid: ", |
328 | }; | 328 | }; |
329 | int i, j; | 329 | int i, j; |
330 | int force_init_uids = 0; | 330 | int force_init_uids = 0; |
331 | 331 | ||
332 | if (!(mailbox->flags & MU_STREAM_READ)) | ||
333 | return 0; | ||
334 | |||
332 | rc = mu_streamref_create (&stream, mailbox->stream); | 335 | rc = mu_streamref_create (&stream, mailbox->stream); |
333 | if (rc) | 336 | if (rc) |
334 | { | 337 | { |
335 | mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR, | 338 | mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR, |
336 | ("%s:%s (%s): %s", | 339 | ("%s:%s (%s): %s", |
337 | __func__, "mu_streamref_create", dmp->name, | 340 | __func__, "mu_streamref_create", dmp->name, |
@@ -587,12 +590,15 @@ dotmail_rescan (mu_mailbox_t mailbox, mu_off_t offset) | |||
587 | struct mu_dotmail_mailbox *dmp = mailbox->data; | 590 | struct mu_dotmail_mailbox *dmp = mailbox->data; |
588 | int rc; | 591 | int rc; |
589 | 592 | ||
590 | if (!dmp) | 593 | if (!dmp) |
591 | return EINVAL; | 594 | return EINVAL; |
592 | 595 | ||
596 | if (!(mailbox->flags & MU_STREAM_READ)) | ||
597 | return 0; | ||
598 | |||
593 | mu_monitor_wrlock (mailbox->monitor); | 599 | mu_monitor_wrlock (mailbox->monitor); |
594 | #ifdef WITH_PTHREAD | 600 | #ifdef WITH_PTHREAD |
595 | pthread_cleanup_push (dotmail_cleanup, (void *)mailbox); | 601 | pthread_cleanup_push (dotmail_cleanup, (void *)mailbox); |
596 | #endif | 602 | #endif |
597 | 603 | ||
598 | rc = mu_stream_size (mailbox->stream, &dmp->size); | 604 | rc = mu_stream_size (mailbox->stream, &dmp->size); |