changeset 2243:6850ff275fa5 HEAD

Check immediately if we have write-access to mbox.
author Timo Sirainen <tss@iki.fi>
date Thu, 24 Jun 2004 17:00:21 +0300
parents 5e2518377c0a
children e7ccd299e754
files src/lib-storage/index/mbox/mbox-storage.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-storage.c	Thu Jun 24 16:47:35 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Thu Jun 24 17:00:21 2004 +0300
@@ -457,6 +457,15 @@
 	ibox->mail_deinit = mbox_mail_deinit;
 	ibox->mail_interface = &mbox_mail;
 
+	if (access(path, R_OK|W_OK) < 0) {
+		if (errno < EACCES)
+			mbox_set_syscall_error(ibox, "access()");
+		else {
+			ibox->readonly = TRUE;
+			ibox->mbox_readonly = TRUE;
+		}
+	}
+
 	return &ibox->box;
 }