diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-21 13:52:52 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-21 13:52:52 +0000 |
commit | f76469cfddc4afd146bda016886dec6474a02b43 (patch) | |
tree | 297d868c9b0990c15e75e2d49266c8169760864a /mailbox | |
parent | 625b1f9da4b87856b5bc288003c72b535160994b (diff) | |
download | mailutils-f76469cfddc4afd146bda016886dec6474a02b43.tar.gz mailutils-f76469cfddc4afd146bda016886dec6474a02b43.tar.bz2 |
(mailbox_flush,mailbox_append_message)
(mailbox_save_attributes,mailbox_expunge): Return EACCES
if mailbox was open readonly.
Diffstat (limited to 'mailbox')
-rw-r--r-- | mailbox/mailbox.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mailbox/mailbox.c b/mailbox/mailbox.c index 205622ab7..386484cbc 100644 --- a/mailbox/mailbox.c +++ b/mailbox/mailbox.c @@ -210,7 +210,9 @@ mailbox_flush (mailbox_t mbox, int expunge) { size_t i, total = 0; int status = 0; - + + if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND))) + return EACCES; mailbox_messages_count (mbox, &total); for (i = 1; i <= total; i++) { @@ -233,6 +235,8 @@ mailbox_append_message (mailbox_t mbox, message_t msg) { if (mbox == NULL || mbox->_append_message == NULL) return MU_ERR_EMPTY_VFN; + if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND))) + return EACCES; return mbox->_append_message (mbox, msg); } @@ -272,6 +276,8 @@ mailbox_save_attributes (mailbox_t mbox) { if (mbox == NULL || mbox->_save_attributes == NULL) return MU_ERR_EMPTY_VFN; + if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND))) + return EACCES; return mbox->_save_attributes (mbox); } @@ -280,6 +286,8 @@ mailbox_expunge (mailbox_t mbox) { if (mbox == NULL || mbox->_expunge == NULL) return MU_ERR_EMPTY_VFN; + if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND))) + return EACCES; return mbox->_expunge (mbox); } |