changeset 9281:3a25f14abf12 HEAD

mbox: Fixed mkdir() error logging. Not all errors are EACCES.
author Timo Sirainen <tss@iki.fi>
date Mon, 03 Aug 2009 12:54:21 -0400
parents 25c9df95fda6
children 9fe57d8ec946
files src/lib-storage/index/mbox/mbox-storage.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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,9 +265,14 @@
 	}
 
 	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;
 	}
 
 	if ((storage->flags & MAIL_STORAGE_FLAG_DEBUG) != 0)
@@ -364,11 +369,16 @@
 					"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;
 		}
 	}