dovecot-2.1: lib-storage: Don't log errors if trying to open a m...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 13 16:33:08 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/37d6dd0f053b
changeset: 14296:37d6dd0f053b
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 13 16:32:56 2012 +0200
description:
lib-storage: Don't log errors if trying to open a mailbox with too long name.
Handle ENAMETOOLONG errors the same as ENOENT.

diffstat:

 src/lib-storage/index/dbox-common/dbox-storage.c |  2 +-
 src/lib-storage/index/maildir/maildir-storage.c  |  4 ++--
 src/lib/compat.h                                 |  3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 352dd32abb8d -r 37d6dd0f053b src/lib-storage/index/dbox-common/dbox-storage.c
--- a/src/lib-storage/index/dbox-common/dbox-storage.c	Tue Mar 13 16:14:13 2012 +0200
+++ b/src/lib-storage/index/dbox-common/dbox-storage.c	Tue Mar 13 16:32:56 2012 +0200
@@ -172,7 +172,7 @@
 
 	if (dbox_cleanup_if_exists(box->list, box_path))
 		;
-	else if (errno == ENOENT) {
+	else if (errno == ENOENT || errno == ENAMETOOLONG) {
 		mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
 			T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
 		return -1;
diff -r 352dd32abb8d -r 37d6dd0f053b src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Tue Mar 13 16:14:13 2012 +0200
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Tue Mar 13 16:32:56 2012 +0200
@@ -207,7 +207,7 @@
 	/* if tmp/ directory exists, we need to clean it up once in a while */
 	path = t_strconcat(dir, "/tmp", NULL);
 	if (stat(path, &st) < 0) {
-		if (errno == ENOENT)
+		if (errno == ENOENT || errno == ENAMETOOLONG)
 			return 0;
 		if (errno == EACCES) {
 			mail_storage_set_critical(storage, "%s",
@@ -361,7 +361,7 @@
 		return maildir_mailbox_open_existing(box);
 	}
 
-	if (errno == ENOENT) {
+	if (errno == ENOENT || errno == ENAMETOOLONG) {
 		mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
 			T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
 		return -1;
diff -r 352dd32abb8d -r 37d6dd0f053b src/lib/compat.h
--- a/src/lib/compat.h	Tue Mar 13 16:14:13 2012 +0200
+++ b/src/lib/compat.h	Tue Mar 13 16:32:56 2012 +0200
@@ -244,7 +244,8 @@
 #endif
 
 #define ENOTFOUND(errno) \
-	((errno) == ENOENT || (errno) == ENOTDIR || (errno) == ELOOP)
+	((errno) == ENOENT || (errno) == ENOTDIR || \
+	 (errno) == ELOOP || (errno) == ENAMETOOLONG)
 
 #define ECANTLINK(errno) \
 	((errno) == EXDEV || (errno) == EMLINK || (errno) == EPERM)


More information about the dovecot-cvs mailing list