changeset 1239:844bf41d831b HEAD

in-memory index crashfixes
author Timo Sirainen <tss@iki.fi>
date Sun, 23 Feb 2003 23:14:50 +0200
parents 2512ad6fd9e9
children 6e893f3f9837
files src/lib-storage/index/maildir/maildir-storage.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sun Feb 23 23:06:57 2003 +0200
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sun Feb 23 23:14:50 2003 +0200
@@ -170,6 +170,9 @@
 {
 	const char *dir;
 
+	if (storage->index_dir == NULL)
+		return TRUE;
+
 	if (strcmp(storage->index_dir, storage->dir) == 0)
 		return TRUE;
 
@@ -338,8 +341,8 @@
 		return FALSE;
 	}
 
-	if (strcmp(storage->index_dir, storage->dir) != 0 &&
-	    *name != '/' && *name != '~') {
+	if (storage->index_dir != NULL && *name != '/' && *name != '~' &&
+	    strcmp(storage->index_dir, storage->dir) != 0) {
 		index_dir = t_strconcat(storage->index_dir, "/.", name, NULL);
 		if (unlink_directory(index_dir, TRUE) < 0) {
 			mail_storage_set_critical(storage,
@@ -382,7 +385,8 @@
 {
 	const char *oldpath, *newpath;
 
-	if (strcmp(storage->index_dir, storage->dir) == 0)
+	if (storage->index_dir == NULL ||
+	    strcmp(storage->index_dir, storage->dir) == 0)
 		return TRUE;
 
 	/* Rename it's index. */