]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Strip trailing '/' from mail directory if given. Just makes it cleaner in
authorTimo Sirainen <tss@iki.fi>
Sun, 5 Oct 2003 19:41:16 +0000 (22:41 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 5 Oct 2003 19:41:16 +0000 (22:41 +0300)
log files.

--HG--
branch : HEAD

src/lib-storage/index/maildir/maildir-storage.c
src/lib-storage/index/mbox/mbox-storage.c

index 5617791652f16cc9bb7a17230c1433fbf9610b89..165e395a8df8cdce2590075b61b65892a706ec48 100644 (file)
@@ -33,6 +33,7 @@ maildir_create(const char *data, const char *user,
        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 @@ maildir_create(const char *data, const char *user,
        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)
index 7bb614aa2a5fe617df5174d64f45ed94499b85f6..091d6212594e4f785f57aeb6c435bc92f3d00ead 100644 (file)
@@ -176,6 +176,11 @@ mbox_create(const char *data, const char *user,
                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)