dovecot-1.2: mbox: Fixed mkdir() error logging. Not all errors a...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 3 19:54:25 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/3a25f14abf12
changeset: 9281:3a25f14abf12
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 03 12:54:21 2009 -0400
description:
mbox: Fixed mkdir() error logging. Not all errors are EACCES.

diffstat:

1 file changed, 13 insertions(+), 3 deletions(-)
src/lib-storage/index/mbox/mbox-storage.c |   16 +++++++++++++---

diffs (36 lines):

diff -r 25c9df95fda6 -r 3a25f14abf12 src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c	Mon Aug 03 12:47:37 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Mon Aug 03 12:54:21 2009 -0400
@@ -265,8 +265,13 @@ static const char *create_root_dir(struc
 	}
 
 	path = t_strconcat(home, "/mail", NULL);
-	if (mkdir_parents(path, CREATE_MODE) < 0 && errno != EEXIST) {
+	if (mkdir_parents(path, CREATE_MODE) == 0) {
+		/* ok */
+	} else if (errno == EACCES) {
 		*error_r = mail_error_create_eacces_msg("mkdir", path);
+		return NULL;
+	} else if (errno != EEXIST) {
+		*error_r = t_strdup_printf("mkdir(%s) failed: %m", path);
 		return NULL;
 	}
 
@@ -364,10 +369,15 @@ mbox_get_list_settings(struct mailbox_li
 					"Root mail directory doesn't exist: %s",
 					list_set->root_dir);
 			return -1;
-		} else if (mkdir_parents(list_set->root_dir, CREATE_MODE) < 0 &&
-			   errno != EEXIST) {
+		} else if (mkdir_parents(list_set->root_dir, CREATE_MODE) == 0) {
+			/* ok */
+		} else if (errno == EACCES) {
 			*error_r = mail_error_create_eacces_msg("mkdir",
 							list_set->root_dir);
+			return -1;
+		} else if (errno != EEXIST) {
+			*error_r = t_strdup_printf("mkdir(%s) failed: %m",
+						   list_set->root_dir);
 			return -1;
 		}
 	}


More information about the dovecot-cvs mailing list