changeset 14332:37d6dd0f053b

lib-storage: Don't log errors if trying to open a mailbox with too long name. Handle ENAMETOOLONG errors the same as ENOENT.
author Timo Sirainen <tss@iki.fi>
date Tue, 13 Mar 2012 16:32:56 +0200
parents 352dd32abb8d
children a3b162331cd1
files src/lib-storage/index/dbox-common/dbox-storage.c src/lib-storage/index/maildir/maildir-storage.c src/lib/compat.h
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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;
--- 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)