changeset 305:21a9d15025c7 HEAD

CREATE and DELETE fixes for mbox (last changes for .98 :)
author Timo Sirainen <tss@iki.fi>
date Mon, 23 Sep 2002 20:23:03 +0300
parents fd304e62e88a
children 3f9c648d34db
files src/lib-storage/index/mbox/mbox-save.c src/lib-storage/index/mbox/mbox-storage.c
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c	Mon Sep 23 20:13:55 2002 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Mon Sep 23 20:23:03 2002 +0300
@@ -114,7 +114,7 @@
 		return FALSE;
 
 	/* append the data into mbox file */
-	fd = open(ibox->index->mbox_path, O_RDWR | O_CREAT);
+	fd = open(ibox->index->mbox_path, O_RDWR | O_CREAT, 0660);
 	if (fd == -1) {
 		mail_storage_set_critical(box->storage, "Can't open mbox file "
 					  "%s: %m", ibox->index->mbox_path);
--- a/src/lib-storage/index/mbox/mbox-storage.c	Mon Sep 23 20:13:55 2002 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Mon Sep 23 20:23:03 2002 +0300
@@ -141,7 +141,7 @@
 	i_snprintf(path, sizeof(path), "%s/inbox", storage->dir);
 
 	/* make sure inbox file itself exists */
-	fd = open(path, O_RDWR | O_CREAT | O_EXCL);
+	fd = open(path, O_RDWR | O_CREAT | O_EXCL, 0660);
 	if (fd != -1)
 		(void)close(fd);
 
@@ -229,14 +229,14 @@
 		return FALSE;
 	}
 
-	if (errno != EEXIST) {
+	if (errno != ENOENT) {
 		mail_storage_set_critical(storage, "stat() failed for mbox "
 					  "file %s: %m", path);
 		return FALSE;
 	}
 
 	/* create the mailbox file */
-	fd = open(path, O_RDWR | O_CREAT | O_EXCL);
+	fd = open(path, O_RDWR | O_CREAT | O_EXCL, 0660);
 	if (fd != -1) {
 		(void)close(fd);
 		return TRUE;
@@ -284,7 +284,7 @@
 
 	/* next delete the index directory */
 	index_dir = mbox_get_index_dir(path);
-	if (!unlink_directory(index_dir)) {
+	if (!unlink_directory(index_dir) && errno != ENOENT) {
 		mail_storage_set_critical(storage, "unlink_directory(%s) "
 					  "failed: %m", index_dir);
 		return FALSE;