changeset 1805:2ef8e4ab3f03 HEAD

Strip trailing '/' from mail directory if given. Just makes it cleaner in log files.
author Timo Sirainen <tss@iki.fi>
date Sun, 05 Oct 2003 22:41:16 +0300
parents e86000107a45
children 0ac9f72a84a8
files src/lib-storage/index/maildir/maildir-storage.c src/lib-storage/index/mbox/mbox-storage.c
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sun Oct 05 21:01:57 2003 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sun Oct 05 22:41:16 2003 +0300
@@ -33,6 +33,7 @@
 	struct mail_storage *storage;
 	const char *root_dir, *inbox_dir, *index_dir, *control_dir;
 	const char *home, *path, *p;
+	size_t len;
 
 	inbox_dir = root_dir = index_dir = control_dir = NULL;
 
@@ -74,6 +75,11 @@
 	if (root_dir == NULL)
 		return NULL;
 
+	/* strip trailing '/' */
+	len = strlen(root_dir);
+	if (root_dir[len-1] == '/')
+		root_dir = t_strndup(root_dir, len-1);
+
 	if (index_dir == NULL)
 		index_dir = root_dir;
 	else if (strcmp(index_dir, "MEMORY") == 0)
--- a/src/lib-storage/index/mbox/mbox-storage.c	Sun Oct 05 21:01:57 2003 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Sun Oct 05 22:41:16 2003 +0300
@@ -176,6 +176,11 @@
 		root_dir = create_root_dir();
 		if (root_dir == NULL)
 			return NULL;
+	} else {
+		/* strip trailing '/' */
+		size_t len = strlen(root_dir);
+		if (root_dir[len-1] == '/')
+			root_dir = t_strndup(root_dir, len-1);
 	}
 
 	if (inbox_file == NULL)