dovecot-2.0: Avoid using PATH_MAX.

dovecot at dovecot.org dovecot at dovecot.org
Wed Dec 16 20:48:22 EET 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/e7cd1b10f18b
changeset: 10503:e7cd1b10f18b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Dec 16 13:48:16 2009 -0500
description:
Avoid using PATH_MAX.

diffstat:

7 files changed, 13 insertions(+), 7 deletions(-)
src/lib-storage/index/shared/shared-list.c       |    2 +-
src/lib-storage/list/mailbox-list-fs.c           |    2 +-
src/lib-storage/list/mailbox-list-fs.h           |    2 +-
src/lib-storage/list/mailbox-list-maildir-iter.c |    2 +-
src/lib-storage/list/mailbox-list-maildir.c      |    4 ++--
src/lib-storage/list/mailbox-list-maildir.h      |    2 +-
src/lib-storage/mailbox-list.h                   |    6 ++++++

diffs (97 lines):

diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/index/shared/shared-list.c
--- a/src/lib-storage/index/shared/shared-list.c	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/index/shared/shared-list.c	Wed Dec 16 13:48:16 2009 -0500
@@ -305,7 +305,7 @@ struct mailbox_list shared_mailbox_list 
 	.name = "shared",
 	.hierarchy_sep = '/',
 	.props = 0,
-	.mailbox_name_max_length = PATH_MAX,
+	.mailbox_name_max_length = MAILBOX_LIST_NAME_MAX_LENGTH,
 
 	{
 		shared_list_alloc,
diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/list/mailbox-list-fs.c
--- a/src/lib-storage/list/mailbox-list-fs.c	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/list/mailbox-list-fs.c	Wed Dec 16 13:48:16 2009 -0500
@@ -417,7 +417,7 @@ struct mailbox_list fs_mailbox_list = {
 	.name = MAILBOX_LIST_NAME_FS,
 	.hierarchy_sep = '/',
 	.props = 0,
-	.mailbox_name_max_length = PATH_MAX,
+	.mailbox_name_max_length = MAILBOX_LIST_NAME_MAX_LENGTH,
 
 	{
 		fs_list_alloc,
diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/list/mailbox-list-fs.h
--- a/src/lib-storage/list/mailbox-list-fs.h	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/list/mailbox-list-fs.h	Wed Dec 16 13:48:16 2009 -0500
@@ -5,7 +5,7 @@
 
 /* Don't allow creating too long mailbox names. They could start causing
    problems when they reach the limit. */
-#define FS_MAX_CREATE_MAILBOX_NAME_LENGTH (PATH_MAX/2)
+#define FS_MAX_CREATE_MAILBOX_NAME_LENGTH (MAILBOX_LIST_NAME_MAX_LENGTH/2)
 
 struct fs_mailbox_list {
 	struct mailbox_list list;
diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/list/mailbox-list-maildir-iter.c
--- a/src/lib-storage/list/mailbox-list-maildir-iter.c	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/list/mailbox-list-maildir-iter.c	Wed Dec 16 13:48:16 2009 -0500
@@ -196,7 +196,7 @@ maildir_fill_readdir(struct maildir_list
 		strcmp(ctx->ctx.list->name, MAILBOX_LIST_NAME_IMAPDIR) != 0 ?
 		ctx->ctx.list->hierarchy_sep : '\0';
 
-	mailbox = t_str_new(PATH_MAX);
+	mailbox = t_str_new(MAILBOX_LIST_NAME_MAX_LENGTH);
 	while ((d = readdir(dirp)) != NULL) {
 		const char *fname = d->d_name;
 
diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/list/mailbox-list-maildir.c
--- a/src/lib-storage/list/mailbox-list-maildir.c	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/list/mailbox-list-maildir.c	Wed Dec 16 13:48:16 2009 -0500
@@ -442,7 +442,7 @@ struct mailbox_list maildir_mailbox_list
 	.name = MAILBOX_LIST_NAME_MAILDIRPLUSPLUS,
 	.hierarchy_sep = '.',
 	.props = MAILBOX_LIST_PROP_NO_MAILDIR_NAME,
-	.mailbox_name_max_length = PATH_MAX,
+	.mailbox_name_max_length = MAILBOX_LIST_NAME_MAX_LENGTH,
 
 	{
 		maildir_list_alloc,
@@ -471,7 +471,7 @@ struct mailbox_list imapdir_mailbox_list
 	.name = MAILBOX_LIST_NAME_IMAPDIR,
 	.hierarchy_sep = '.',
 	.props = MAILBOX_LIST_PROP_NO_MAILDIR_NAME,
-	.mailbox_name_max_length = PATH_MAX,
+	.mailbox_name_max_length = MAILBOX_LIST_NAME_MAX_LENGTH,
 
 	{
 		imapdir_list_alloc,
diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/list/mailbox-list-maildir.h
--- a/src/lib-storage/list/mailbox-list-maildir.h	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/list/mailbox-list-maildir.h	Wed Dec 16 13:48:16 2009 -0500
@@ -5,7 +5,7 @@
 
 /* Don't allow creating too long mailbox names. They could start causing
    problems when they reach the limit. */
-#define MAILDIR_MAX_CREATE_MAILBOX_NAME_LENGTH (PATH_MAX/2)
+#define MAILDIR_MAX_CREATE_MAILBOX_NAME_LENGTH (MAILBOX_LIST_NAME_MAX_LENGTH/2)
 
 struct maildir_mailbox_list {
 	struct mailbox_list list;
diff -r 13be6ac759ee -r e7cd1b10f18b src/lib-storage/mailbox-list.h
--- a/src/lib-storage/mailbox-list.h	Wed Dec 16 13:43:23 2009 -0500
+++ b/src/lib-storage/mailbox-list.h	Wed Dec 16 13:48:16 2009 -0500
@@ -3,6 +3,12 @@
 
 #include "mail-types.h"
 #include "mail-error.h"
+
+#ifdef PATH_MAX
+#  define MAILBOX_LIST_NAME_MAX_LENGTH PATH_MAX
+#else
+#  define MAILBOX_LIST_NAME_MAX_LENGTH 4096
+#endif
 
 struct mail_namespace;
 struct mail_storage;


More information about the dovecot-cvs mailing list